dbtbnameValidate.sim 5.9 KB
Newer Older
S
slguan 已提交
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 50 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 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
system sh/stop_dnodes.sh
system sh/ip.sh -i 1 -s up
system sh/deploy.sh -n dnode1 -m 192.168.0.1 -i 192.168.0.1
system sh/cfg.sh -n dnode1 -c commitLog -v 0
system sh/exec.sh -n dnode1 -s start
sleep 1000
sql connect

print ========== db name and table name check in create and drop, describe
sql create database abc keep 36500
sql create database 'abc123'
sql create database '_ab1234'
sql create database 'ABC123'
sql create database '_ABC123'
sql create database 'aABb123 '
sql create database ' xyz '
sql create database ' XYZ '

sql use 'abc123'
sql use '_ab1234'
sql use 'ABC123'
sql use '_ABC123'
sql use 'aABb123'
sql use ' xyz '
sql use ' XYZ '

sql drop database 'abc123'
sql drop database '_ab1234'
sql drop database 'ABC123'
sql drop database '_ABC123'
sql drop database 'aABb123'
sql drop database ' xyz '
sql drop database ' XYZ '


sql use abc

sql create table  abc.cc    (ts timestamp, c int)
sql create table 'abc.Dd'   (ts timestamp, c int)
sql create table 'abc'.ee   (ts timestamp, c int)
sql create table 'abc'.'FF' (ts timestamp, c int)
sql create table  abc.'gG'  (ts timestamp, c int)

sql_error create table  table.'a1'  (ts timestamp, c int)
sql_error create table 'table'.'b1' (ts timestamp, c int)
sql_error create table 'table'.'b1' (ts timestamp, c int)


sql create table mt (ts timestamp, c1 int, c2 bigint, c3 float, c4 double, c5 smallint, c6 tinyint, c7 bool, c8 binary(10), c9 nchar(10)) tags(t1 int, t2 nchar(20), t3 binary(20), t4 bigint, t5 smallint, t6 double)
sql create table sub_001 using mt tags ( 1 , 'tag_nchar' , 'tag_bianry' , 4 , 5 , 6.1 )
sql_error create table sub_002 using mt tags( 2 , tag_nchar , tag_bianry , 4 , 5 , 6.2 )
sql insert into sub_dy_tbl using mt tags ( 3 , 'tag_nchar' , 'tag_bianry' , 4 , 5 , 6.3 ) values (now, 1, 2, 3.01, 4.02, 5, 6, true, 'binary_8', 'nchar_9')

sql describe abc.cc
sql describe 'abc.Dd'
sql describe 'abc'.ee
sql describe 'abc'.'FF'
sql describe abc.'gG'

sql describe cc
sql describe 'Dd'
sql describe ee
sql describe 'FF'
sql describe 'gG'

sql describe mt
sql describe sub_001
sql describe sub_dy_tbl

sql_error describe Dd
sql_error describe FF
sql_error describe gG

sql drop table abc.cc
sql drop table  'abc.Dd'
sql drop table  'abc'.ee
sql drop table  'abc'.'FF'
sql drop table  abc.'gG'

sql drop table   sub_001

sql drop table   sub_dy_tbl
sql drop table   mt

print ========== insert data by multi-format
sql create table abc.tk_mt (ts timestamp, a int, b binary(16), c bool, d float, e double, f nchar(16)) tags (t1 int, t2 binary(16))

sql create table abc.tk_subt001 using tk_mt tags(1, 'subt001')
sql insert into abc.tk_subt001                  values (now-1y, 1, 'binary_1', true,  1.001, 2.001, 'nchar_1')
sql insert into abc.tk_subt001                  values (now-1n, 2, 'binary_2', true,  1.002, 2.002, 'nchar_2') 
sql insert into abc.tk_subt001                  values (now-1w, 3, 'binary_3', true,  1.003, 2.003, 'nchar_3')
sql insert into abc.tk_subt001 (ts, a, c, e, f) values (now-1d, 4,             false,        2.004, 'nchar_4')
sql insert into abc.tk_subt001 (ts, a, c, e, f) values (now-1h, 5,             false,        2.005, 'nchar_5')
sql insert into abc.tk_subt001 (ts, b, d)       values (now-1m,    'binary_6',        1.006)
sql insert into abc.tk_subt001 (ts, b, d)       values (now-1s,    'binary_7',        1.007)
sql insert into abc.tk_subt001 (ts, b, d)       values (now-1a,    'binary_8',        1.008)
sql select * from tk_subt001
if $rows != 8 then 
  print ==== expect rows is 8, but actually is $rows
  return -1
endi

sql insert into abc.tk_subt002 using tk_mt tags (22,'subt002x')  values (now-2y, 2008, 'binary_2008', false, 2008.001, 2008.001, 'nchar_2008')
sql insert into abc.tk_subt002 using tk_mt tags (2, 'subt002')   values (now-1y, 2007, 'binary_2007', false, 2007.001, 2007.001, 'nchar_2007')
sql insert into abc.tk_subt002 using tk_mt tags (2, 'subt002')   values (now-1n, 2006, 'binary_2006', true,  2006.001, 2006.001, 'nchar_2006')
sql insert into abc.tk_subt002 using tk_mt tags (2, 'subt002')   values (now+1s, 2001, 'binary_2001', true,  2001.001, 2001.001, 'nchar_2001')
sql insert into abc.tk_subt002 using tk_mt tags (2, 'subt002')   values (now+1m, 2002, 'binary_2002', false, 2002.001, 2002.001, 'nchar_2002')  
sql insert into abc.tk_subt002 using tk_mt tags (2, 'subt002')   values (now+1h, 2003, 'binary_2003', false, 2003.001, 2003.001, 'nchar_2003')
sql insert into abc.tk_subt002 using tk_mt tags (2, 'subt002')   values (now+1d, 2004, 'binary_2004', true,  2004.001, 2004.001, 'nchar_2004')
sql insert into abc.tk_subt002 using tk_mt tags (2, 'subt002')   values (now+1w, 2005, 'binary_2005', false, 2005.001, 2005.001, 'nchar_2005')
sql select * from tk_subt002
if $rows != 8 then 
  print ==== expect rows is 8, but actually is $rows
  return -1
endi

sql insert into abc.tk_subt003 (ts, a, c, e, f) using tk_mt tags (3, 'subt003')    values (now-5y,  3001,                false, 3001.001,           'nchar_3001')
sql insert into abc.tk_subt003 (ts, a, c, e, f) using tk_mt tags (3, 'subt003')    values (now-4y,  3002,                false, 3002.001,           'nchar_3002')
sql insert into abc.tk_subt003 (ts, a, c, e, f) using tk_mt tags (3, 'subt003')    values (now-3y,  3003,                true , 3003.001,           'nchar_3003')
sql insert into abc.tk_subt003 (ts, a, c, e, f) using tk_mt tags (3, 'subt003')    values (now-2y,  3004,                false, 3004.001,           'nchar_3004')
sql insert into abc.tk_subt003                                                     values (now-37d, 3005, 'binary_3005', false, 3005.001, 3005.001, 'nchar_3005')
sql insert into abc.tk_subt003                                                     values (now-36d, 3006, 'binary_3006', true,  3006.001, 3006.001, 'nchar_3006')
sql insert into abc.tk_subt003 (ts, a, c, e, f) using tk_mt tags (33, 'subt003x')  values (now-35d, 3007,                false, 3007.001,           'nchar_3007')
sql select * from tk_subt003
if $rows != 7 then 
  print ==== expect rows is 7, but actually is $rows
  return -1
endi