alter_stable.sim 1.6 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
sql connect

print ========== alter_stable.sim

$db = demodb
sql drop database if exists $db
sql create database $db
sql use $db

S
Shengliang Guan 已提交
13 14
##### alter stable test : rename tag name
# case-1  rename tag name: new name inclue old name
15
sql create table mt1 (ts timestamp, c1 int) tags (a int)
S
Shengliang Guan 已提交
16 17 18
sql alter table mt1 rename tag a abcd
sql alter table mt1 rename tag abcd a
sql_error alter table mt1 rename tag a 1
19 20 21 22 23

sql_error create table mtx1 (ts timestamp, c1 int) tags (123 int)

sql_error create table mt2 (ts timestamp, c1 int) tags (abc012345678901234567890123456789012345678901234567890123456789def int)
sql create table mt3 (ts timestamp, c1 int) tags (abc012345678901234567890123456789012345678901234567890123456789 int)
S
Shengliang Guan 已提交
24 25
sql_error alter table mt3 rename tag abc012345678901234567890123456789012345678901234567890123456789 abcdefg012345678901234567890123456789012345678901234567890123456789
sql alter table mt3 rename tag abc012345678901234567890123456789012345678901234567890123456789 abcdefg0123456789012345678901234567890123456789
26 27 28 29 30 31 32 33 34 35 36

# case-2 set tag value
sql create table mt4 (ts timestamp, c1 int) tags (name binary(16), len int)
sql create table tb1 using mt4 tags ("beijing", 100)
sql alter table tb1 set tag name = "shanghai"
sql alter table tb1 set tag name = ""
sql alter table tb1 set tag name = "shenzhen"
sql alter table tb1 set tag len = 379

# case TD-5594
sql create stable st5520(ts timestamp, f int) tags(t0 bool, t1 nchar(4093), t2 nchar(1))
S
Shengliang Guan 已提交
37
sql alter stable st5520 modify tag t2 nchar(2);
38 39 40 41
# test end   
sql drop database $db

system sh/exec.sh -n dnode1 -s stop -x SIGINT