column_modify.sim 2.2 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
sql connect

print ========== prepare stb and ctb
sql create database db vgroups 1
sql create table db.stb (ts timestamp, c1 int, c2 binary(4)) tags(t1 int, t2 float, t3 binary(16)) comment "abd"
sql create table db.ctb using db.stb tags(101, 102, "103")
sql insert into db.ctb values(now, 1, "1234")

sql_error alter table db.stb MODIFY column c2 binary(3)
sql_error alter table db.stb MODIFY column c2 int
sql_error alter table db.stb MODIFY column c1 int
sql_error alter table db.stb MODIFY column ts int
sql_error insert into db.ctb values(now, 1, "12345")

print ========== step1 modify column
sql alter table db.stb MODIFY column c2 binary(5)
sql insert into db.ctb values(now, 1, "12345")

sql select * from db.stb
print $data[0][0] $data[0][1] $data[0][2] $data[0][3] $data[0][4] $data[0][5] $data[0][6]
print $data[1][0] $data[1][1] $data[1][2] $data[1][3] $data[1][4] $data[1][5] $data[1][6]

if $rows != 2 then
  return -1
endi
if $data[0][1] != 1 then
  return -1
endi
if $data[0][2] != 1234 then
  return -1
endi  
if $data[0][3] != 101 then
  return -1
endi
if $data[1][1] != 1 then
  return -1
endi
if $data[1][2] != 12345 then
  return -1
endi
if $data[1][3] != 101 then
  return -1
endi

print ========== step2 describe
sql describe db.ctb
S
Shengliang Guan 已提交
50
if $rows != 6 then
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
  return -1
endi
if $data[0][0] != ts then
  return -1
endi
if $data[1][0] != c1 then
  return -1
endi
if $data[2][0] != c2 then
  return -1
endi
if $data[2][1] != VARCHAR then
  return -1
endi
if $data[2][2] != 5 then
  return -1
endi
if $data[3][0] != t1 then
  return -1
endi
if $data[4][0] != t2 then
  return -1
endi
if $data[5][0] != t3 then
  return -1
endi

S
Shengliang Guan 已提交
78 79 80 81 82 83 84 85 86
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s start

sql connect
sql select * from db.ctb

if $rows != 2 then
  return -1
endi
S
Shengliang Guan 已提交
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
#if $data[0][1] != 1 then
#  return -1
#endi
#if $data[0][2] != 1234 then
#  return -1
#endi  
#if $data[0][3] != 101 then
#  return -1
#endi
#if $data[1][1] != 1 then
#  return -1
#endi
#if $data[1][2] != 12345 then
#  return -1
#endi
#if $data[1][3] != 101 then
#  return -1
#endi
S
Shengliang Guan 已提交
105

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