770 lines
		
	
	
		
			11 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
			
		
		
	
	
			770 lines
		
	
	
		
			11 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
| sleep 2000
 | |
| sql connect
 | |
| 
 | |
| sql show databases
 | |
| sql drop database $data00 -x e1
 | |
| e1:
 | |
| sql show databases
 | |
| sql drop database $data00 -x e2
 | |
| e2:
 | |
| 
 | |
| print ======== step1 
 | |
| sql create database d2
 | |
| sql use d2
 | |
| sql create table mt (ts timestamp, a int) TAGS (t int)
 | |
| sql create table tb using mt tags (1)
 | |
| sql insert into tb values(now-28d, -28)
 | |
| sql insert into tb values(now-27d, -27)
 | |
| sql insert into tb values(now-26d, -26)
 | |
| sql select * from tb
 | |
| if $rows != 3 then
 | |
|   return -1
 | |
| endi
 | |
| sql describe tb
 | |
| if $data00 != ts then
 | |
|   return -1
 | |
| endi
 | |
| if $data01 != TIMESTAMP then
 | |
|   return -1
 | |
| endi
 | |
| if $data10 != a then
 | |
|   return -1
 | |
| endi
 | |
| if $data11 != INT then
 | |
|   return -1
 | |
| endi
 | |
| if $data20 != t then
 | |
|   return -1
 | |
| endi
 | |
| if $data21 != INT then
 | |
|   return -1
 | |
| endi
 | |
| 
 | |
| print ======== step2
 | |
| sql alter table mt add column b smallint
 | |
| sql describe tb
 | |
| if $data00 != ts then
 | |
|   return -1
 | |
| endi
 | |
| if $data01 != TIMESTAMP then
 | |
|   return -1
 | |
| endi
 | |
| if $data10 != a then
 | |
|   return -1
 | |
| endi
 | |
| if $data11 != INT then
 | |
|   return -1
 | |
| endi
 | |
| if $data20 != b then
 | |
|   return -1
 | |
| endi
 | |
| if $data21 != SMALLINT then
 | |
|   return -1
 | |
| endi
 | |
| if $data30 != t then
 | |
|   return -1
 | |
| endi
 | |
| if $data31 != INT then
 | |
|   return -1
 | |
| endi
 | |
| 
 | |
| print ======== step3
 | |
| sql alter table mt add column c tinyint
 | |
| sql describe tb
 | |
| if $data00 != ts then
 | |
|   return -1
 | |
| endi
 | |
| if $data01 != TIMESTAMP then
 | |
|   return -1
 | |
| endi
 | |
| if $data10 != a then
 | |
|   return -1
 | |
| endi
 | |
| if $data11 != INT then
 | |
|   return -1
 | |
| endi
 | |
| if $data20 != b then
 | |
|   return -1
 | |
| endi
 | |
| if $data21 != SMALLINT then
 | |
|   return -1
 | |
| endi
 | |
| if $data30 != c then
 | |
|   return -1
 | |
| endi
 | |
| if $data31 != TINYINT then
 | |
|   return -1
 | |
| endi
 | |
| if $data40 != t then
 | |
|   return -1
 | |
| endi
 | |
| if $data41 != INT then
 | |
|   return -1
 | |
| endi
 | |
| 
 | |
| print ======== step4
 | |
| sql alter table mt add column d int
 | |
| sql describe tb
 | |
| if $data00 != ts then
 | |
|   return -1
 | |
| endi
 | |
| if $data01 != TIMESTAMP then
 | |
|   return -1
 | |
| endi
 | |
| if $data10 != a then
 | |
|   return -1
 | |
| endi
 | |
| if $data11 != INT then
 | |
|   return -1
 | |
| endi
 | |
| if $data20 != b then
 | |
|   return -1
 | |
| endi
 | |
| if $data21 != SMALLINT then
 | |
|   return -1
 | |
| endi
 | |
| if $data30 != c then
 | |
|   return -1
 | |
| endi
 | |
| if $data31 != TINYINT then
 | |
|   return -1
 | |
| endi
 | |
| if $data40 != d then
 | |
|   return -1
 | |
| endi
 | |
| if $data41 != INT then
 | |
|   return -1
 | |
| endi
 | |
| if $data50 != t then
 | |
|   return -1
 | |
| endi
 | |
| if $data51 != INT then
 | |
|   return -1
 | |
| endi
 | |
| 
 | |
| print ======== step5
 | |
| sql alter table mt add column e bigint
 | |
| sql describe tb
 | |
| if $data00 != ts then
 | |
|   return -1
 | |
| endi
 | |
| if $data01 != TIMESTAMP then
 | |
|   return -1
 | |
| endi
 | |
| if $data10 != a then
 | |
|   return -1
 | |
| endi
 | |
| if $data11 != INT then
 | |
|   return -1
 | |
| endi
 | |
| if $data20 != b then
 | |
|   return -1
 | |
| endi
 | |
| if $data21 != SMALLINT then
 | |
|   return -1
 | |
| endi
 | |
| if $data30 != c then
 | |
|   return -1
 | |
| endi
 | |
| if $data31 != TINYINT then
 | |
|   return -1
 | |
| endi
 | |
| if $data40 != d then
 | |
|   return -1
 | |
| endi
 | |
| if $data41 != INT then
 | |
|   return -1
 | |
| endi
 | |
| if $data50 != e then
 | |
|   return -1
 | |
| endi
 | |
| if $data51 != BIGINT then
 | |
|   return -1
 | |
| endi
 | |
| if $data60 != t then
 | |
|   return -1
 | |
| endi
 | |
| if $data61 != INT then
 | |
|   return -1
 | |
| endi
 | |
| 
 | |
| print ======== step6
 | |
| sql alter table mt add column f float
 | |
| sql describe tb
 | |
| if $data00 != ts then
 | |
|   return -1
 | |
| endi
 | |
| if $data01 != TIMESTAMP then
 | |
|   return -1
 | |
| endi
 | |
| if $data10 != a then
 | |
|   return -1
 | |
| endi
 | |
| if $data11 != INT then
 | |
|   return -1
 | |
| endi
 | |
| if $data20 != b then
 | |
|   return -1
 | |
| endi
 | |
| if $data21 != SMALLINT then
 | |
|   return -1
 | |
| endi
 | |
| if $data30 != c then
 | |
|   return -1
 | |
| endi
 | |
| if $data31 != TINYINT then
 | |
|   return -1
 | |
| endi
 | |
| if $data40 != d then
 | |
|   return -1
 | |
| endi
 | |
| if $data41 != INT then
 | |
|   return -1
 | |
| endi
 | |
| if $data50 != e then
 | |
|   return -1
 | |
| endi
 | |
| if $data51 != BIGINT then
 | |
|   return -1
 | |
| endi
 | |
| if $data60 != f then
 | |
|   return -1
 | |
| endi
 | |
| if $data61 != FLOAT then
 | |
|   return -1
 | |
| endi
 | |
| if $data70 != t then
 | |
|   return -1
 | |
| endi
 | |
| if $data71 != INT then
 | |
|   return -1
 | |
| endi
 | |
| 
 | |
| print ======== step7
 | |
| sql alter table mt add column g double
 | |
| sql describe tb
 | |
| if $data00 != ts then
 | |
|   return -1
 | |
| endi
 | |
| if $data01 != TIMESTAMP then
 | |
|   return -1
 | |
| endi
 | |
| if $data10 != a then
 | |
|   return -1
 | |
| endi
 | |
| if $data11 != INT then
 | |
|   return -1
 | |
| endi
 | |
| if $data20 != b then
 | |
|   return -1
 | |
| endi
 | |
| if $data21 != SMALLINT then
 | |
|   return -1
 | |
| endi
 | |
| if $data30 != c then
 | |
|   return -1
 | |
| endi
 | |
| if $data31 != TINYINT then
 | |
|   return -1
 | |
| endi
 | |
| if $data40 != d then
 | |
|   return -1
 | |
| endi
 | |
| if $data41 != INT then
 | |
|   return -1
 | |
| endi
 | |
| if $data50 != e then
 | |
|   return -1
 | |
| endi
 | |
| if $data51 != BIGINT then
 | |
|   return -1
 | |
| endi
 | |
| if $data60 != f then
 | |
|   return -1
 | |
| endi
 | |
| if $data61 != FLOAT then
 | |
|   return -1
 | |
| endi
 | |
| if $data70 != g then
 | |
|   return -1
 | |
| endi
 | |
| if $data71 != DOUBLE then
 | |
|   return -1
 | |
| endi
 | |
| if $data80 != t then
 | |
|   return -1
 | |
| endi
 | |
| if $data81 != INT then
 | |
|   return -1
 | |
| endi
 | |
| 
 | |
| print ======== step8
 | |
| sql alter table mt add column h binary(10)
 | |
| sql describe tb
 | |
| if $data00 != ts then
 | |
|   return -1
 | |
| endi
 | |
| if $data01 != TIMESTAMP then
 | |
|   return -1
 | |
| endi
 | |
| if $data10 != a then
 | |
|   return -1
 | |
| endi
 | |
| if $data11 != INT then
 | |
|   return -1
 | |
| endi
 | |
| if $data20 != b then
 | |
|   return -1
 | |
| endi
 | |
| if $data21 != SMALLINT then
 | |
|   return -1
 | |
| endi
 | |
| if $data30 != c then
 | |
|   return -1
 | |
| endi
 | |
| if $data31 != TINYINT then
 | |
|   return -1
 | |
| endi
 | |
| if $data40 != d then
 | |
|   return -1
 | |
| endi
 | |
| if $data41 != INT then
 | |
|   return -1
 | |
| endi
 | |
| if $data50 != e then
 | |
|   return -1
 | |
| endi
 | |
| if $data51 != BIGINT then
 | |
|   return -1
 | |
| endi
 | |
| if $data60 != f then
 | |
|   return -1
 | |
| endi
 | |
| if $data61 != FLOAT then
 | |
|   return -1
 | |
| endi
 | |
| if $data70 != g then
 | |
|   return -1
 | |
| endi
 | |
| if $data71 != DOUBLE then
 | |
|   return -1
 | |
| endi
 | |
| if $data80 != h then
 | |
|   return -1
 | |
| endi
 | |
| if $data81 != BINARY then
 | |
|   return -1
 | |
| endi
 | |
| if $data82 != 10 then
 | |
|   return -1
 | |
| endi
 | |
| if $data90 != t then
 | |
|   return -1
 | |
| endi
 | |
| if $data91 != INT then
 | |
|   return -1
 | |
| endi
 | |
| 
 | |
| print ======== step9
 | |
| print ======== step10
 | |
| system sh/exec.sh -n dnode1 -s stop -x SIGINT
 | |
| sleep 3000
 | |
| system sh/exec.sh -n dnode1 -s start
 | |
| sleep 3000
 | |
| 
 | |
| sql use d2
 | |
| sql describe tb
 | |
| if $data00 != ts then
 | |
|   return -1
 | |
| endi
 | |
| if $data01 != TIMESTAMP then
 | |
|   return -1
 | |
| endi
 | |
| if $data10 != a then
 | |
|   return -1
 | |
| endi
 | |
| if $data11 != INT then
 | |
|   return -1
 | |
| endi
 | |
| if $data20 != b then
 | |
|   return -1
 | |
| endi
 | |
| if $data21 != SMALLINT then
 | |
|   return -1
 | |
| endi
 | |
| if $data30 != c then
 | |
|   return -1
 | |
| endi
 | |
| if $data31 != TINYINT then
 | |
|   return -1
 | |
| endi
 | |
| if $data40 != d then
 | |
|   return -1
 | |
| endi
 | |
| if $data41 != INT then
 | |
|   return -1
 | |
| endi
 | |
| if $data50 != e then
 | |
|   return -1
 | |
| endi
 | |
| if $data51 != BIGINT then
 | |
|   return -1
 | |
| endi
 | |
| if $data60 != f then
 | |
|   return -1
 | |
| endi
 | |
| if $data61 != FLOAT then
 | |
|   return -1
 | |
| endi
 | |
| if $data70 != g then
 | |
|   return -1
 | |
| endi
 | |
| if $data71 != DOUBLE then
 | |
|   return -1
 | |
| endi
 | |
| if $data80 != h then
 | |
|   return -1
 | |
| endi
 | |
| if $data81 != BINARY then
 | |
|   return -1
 | |
| endi
 | |
| if $data82 != 10 then
 | |
|   return -1
 | |
| endi
 | |
| if $data90 != t then
 | |
|   return -1
 | |
| endi
 | |
| if $data91 != INT then
 | |
|   return -1
 | |
| endi
 | |
| 
 | |
| print ======== step11
 | |
| #sql alter table mt drop column a -x step111
 | |
| #  return -1
 | |
| #step111:
 | |
| 
 | |
| #sql alter table mt drop column ts -x step112
 | |
| #  return -1
 | |
| #step112:
 | |
| 
 | |
| #sql alter table mt drop column cdfg -x step113
 | |
| #  return -1
 | |
| #step113:
 | |
| 
 | |
| #sql alter table mt add column a -x step114
 | |
| #  return -1
 | |
| #step114:
 | |
| 
 | |
| #sql alter table mt add column b -x step115
 | |
| #  return -1
 | |
| #step115:
 | |
| 
 | |
| print ======== step12
 | |
| sql alter table mt drop column b
 | |
| sql describe tb
 | |
| if $data00 != ts then
 | |
|   return -1
 | |
| endi
 | |
| if $data01 != TIMESTAMP then
 | |
|   return -1
 | |
| endi
 | |
| if $data10 != a then
 | |
|   return -1
 | |
| endi
 | |
| if $data11 != INT then
 | |
|   return -1
 | |
| endi
 | |
| if $data20 != c then
 | |
|   return -1
 | |
| endi
 | |
| if $data21 != TINYINT then
 | |
|   return -1
 | |
| endi
 | |
| if $data30 != d then
 | |
|   return -1
 | |
| endi
 | |
| if $data31 != INT then
 | |
|   return -1
 | |
| endi
 | |
| if $data40 != e then
 | |
|   return -1
 | |
| endi
 | |
| if $data41 != BIGINT then
 | |
|   return -1
 | |
| endi
 | |
| if $data50 != f then
 | |
|   return -1
 | |
| endi
 | |
| if $data51 != FLOAT then
 | |
|   return -1
 | |
| endi
 | |
| if $data60 != g then
 | |
|   return -1
 | |
| endi
 | |
| if $data61 != DOUBLE then
 | |
|   return -1
 | |
| endi
 | |
| if $data70 != h then
 | |
|   return -1
 | |
| endi
 | |
| if $data71 != BINARY then
 | |
|   return -1
 | |
| endi
 | |
| if $data72 != 10 then
 | |
|   return -1
 | |
| endi
 | |
| if $data80 != t then
 | |
|   return -1
 | |
| endi
 | |
| if $data81 != INT then
 | |
|   return -1
 | |
| endi
 | |
| 
 | |
| print ======== step13
 | |
| sql alter table mt drop column c
 | |
| sql describe tb
 | |
| if $data00 != ts then
 | |
|   return -1
 | |
| endi
 | |
| if $data01 != TIMESTAMP then
 | |
|   return -1
 | |
| endi
 | |
| if $data10 != a then
 | |
|   return -1
 | |
| endi
 | |
| if $data11 != INT then
 | |
|   return -1
 | |
| endi
 | |
| if $data20 != d then
 | |
|   return -1
 | |
| endi
 | |
| if $data21 != INT then
 | |
|   return -1
 | |
| endi
 | |
| if $data30 != e then
 | |
|   return -1
 | |
| endi
 | |
| if $data31 != BIGINT then
 | |
|   return -1
 | |
| endi
 | |
| if $data40 != f then
 | |
|   return -1
 | |
| endi
 | |
| if $data41 != FLOAT then
 | |
|   return -1
 | |
| endi
 | |
| if $data50 != g then
 | |
|   return -1
 | |
| endi
 | |
| if $data51 != DOUBLE then
 | |
|   return -1
 | |
| endi
 | |
| if $data60 != h then
 | |
|   return -1
 | |
| endi
 | |
| if $data61 != BINARY then
 | |
|   return -1
 | |
| endi
 | |
| if $data62 != 10 then
 | |
|   return -1
 | |
| endi
 | |
| if $data70 != t then
 | |
|   return -1
 | |
| endi
 | |
| if $data71 != INT then
 | |
|   return -1
 | |
| endi
 | |
| 
 | |
| print ======== step14
 | |
| sql alter table mt drop column d
 | |
| sql describe tb
 | |
| if $data00 != ts then
 | |
|   return -1
 | |
| endi
 | |
| if $data01 != TIMESTAMP then
 | |
|   return -1
 | |
| endi
 | |
| if $data10 != a then
 | |
|   return -1
 | |
| endi
 | |
| if $data11 != INT then
 | |
|   return -1
 | |
| endi
 | |
| if $data20 != e then
 | |
|   return -1
 | |
| endi
 | |
| if $data21 != BIGINT then
 | |
|   return -1
 | |
| endi
 | |
| if $data30 != f then
 | |
|   return -1
 | |
| endi
 | |
| if $data31 != FLOAT then
 | |
|   return -1
 | |
| endi
 | |
| if $data40 != g then
 | |
|   return -1
 | |
| endi
 | |
| if $data41 != DOUBLE then
 | |
|   return -1
 | |
| endi
 | |
| if $data50 != h then
 | |
|   return -1
 | |
| endi
 | |
| if $data51 != BINARY then
 | |
|   return -1
 | |
| endi
 | |
| if $data52 != 10 then
 | |
|   return -1
 | |
| endi
 | |
| if $data60 != t then
 | |
|   return -1
 | |
| endi
 | |
| if $data61 != INT then
 | |
|   return -1
 | |
| endi
 | |
| 
 | |
| print ======== step15
 | |
| sql alter table mt drop column e
 | |
| sql describe tb
 | |
| if $data00 != ts then
 | |
|   return -1
 | |
| endi
 | |
| if $data01 != TIMESTAMP then
 | |
|   return -1
 | |
| endi
 | |
| if $data10 != a then
 | |
|   return -1
 | |
| endi
 | |
| if $data11 != INT then
 | |
|   return -1
 | |
| endi
 | |
| if $data20 != f then
 | |
|   return -1
 | |
| endi
 | |
| if $data21 != FLOAT then
 | |
|   return -1
 | |
| endi
 | |
| if $data30 != g then
 | |
|   return -1
 | |
| endi
 | |
| if $data31 != DOUBLE then
 | |
|   return -1
 | |
| endi
 | |
| if $data40 != h then
 | |
|   return -1
 | |
| endi
 | |
| if $data41 != BINARY then
 | |
|   return -1
 | |
| endi
 | |
| if $data42 != 10 then
 | |
|   return -1
 | |
| endi
 | |
| if $data50 != t then
 | |
|   return -1
 | |
| endi
 | |
| if $data51 != INT then
 | |
|   return -1
 | |
| endi
 | |
| 
 | |
| print ======== step16
 | |
| sql alter table mt drop column f
 | |
| sql describe tb
 | |
| if $data00 != ts then
 | |
|   return -1
 | |
| endi
 | |
| if $data01 != TIMESTAMP then
 | |
|   return -1
 | |
| endi
 | |
| if $data10 != a then
 | |
|   return -1
 | |
| endi
 | |
| if $data11 != INT then
 | |
|   return -1
 | |
| endi
 | |
| if $data20 != g then
 | |
|   return -1
 | |
| endi
 | |
| if $data21 != DOUBLE then
 | |
|   return -1
 | |
| endi
 | |
| if $data30 != h then
 | |
|   return -1
 | |
| endi
 | |
| if $data31 != BINARY then
 | |
|   return -1
 | |
| endi
 | |
| if $data32 != 10 then
 | |
|   return -1
 | |
| endi
 | |
| if $data40 != t then
 | |
|   return -1
 | |
| endi
 | |
| if $data41 != INT then
 | |
|   return -1
 | |
| endi
 | |
| 
 | |
| print ======== step17
 | |
| sql alter table mt drop column g
 | |
| sql describe tb
 | |
| if $data00 != ts then
 | |
|   return -1
 | |
| endi
 | |
| if $data01 != TIMESTAMP then
 | |
|   return -1
 | |
| endi
 | |
| if $data10 != a then
 | |
|   return -1
 | |
| endi
 | |
| if $data11 != INT then
 | |
|   return -1
 | |
| endi
 | |
| if $data20 != h then
 | |
|   return -1
 | |
| endi
 | |
| if $data21 != BINARY then
 | |
|   return -1
 | |
| endi
 | |
| if $data22 != 10 then
 | |
|   return -1
 | |
| endi
 | |
| if $data30 != t then
 | |
|   return -1
 | |
| endi
 | |
| if $data31 != INT then
 | |
|   return -1
 | |
| endi
 | |
| 
 | |
| print ============= step18
 | |
| sql alter table mt drop column h
 | |
| sql describe tb
 | |
| if $data00 != ts then
 | |
|   return -1
 | |
| endi
 | |
| if $data01 != TIMESTAMP then
 | |
|   return -1
 | |
| endi
 | |
| if $data10 != a then
 | |
|   return -1
 | |
| endi
 | |
| if $data11 != INT then
 | |
|   return -1
 | |
| endi
 | |
| if $data20 != t then
 | |
|   return -1
 | |
| endi
 | |
| if $data21 != INT then
 | |
|   return -1
 | |
| endi
 | |
| if $data30 != null then
 | |
|   return -1
 | |
| endi
 | |
| 
 | |
| print ======= over
 | |
| sql drop database d2
 | |
| sql show databases
 | |
| if $rows != 0 then 
 | |
|   return -1
 | |
| endi
 | |
| 
 |