dbtbnameValidate.sim 5.0 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 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
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
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_error create database 'aABb123 '
sql_error create database ' xyz '
sql_error create database ' XYZ '

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

sql drop database 'abc123'
sql drop database '_ab1234'
sql_error drop database 'ABC123'
sql drop database '_ABC123'
sql_error drop database 'aABb123'
sql_error drop database ' xyz '
sql_error 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 describe Dd
sql describe FF
sql 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-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 != 6 then 
  print ==== expect rows is 6, but actually is $rows
  return -1
endi

sql insert into abc.tk_subt002 using tk_mt tags (22, 'subt002x')   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 != 5 then 
  print ==== expect rows is 5, 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-38d, 3004,                false, 3004.001,           'nchar_3004')
sql insert into abc.tk_subt003 (ts, a, c, e, f) using tk_mt tags (3, 'subt003')    values (now-37d, 3005,                false, 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 != 4 then 
  print ==== expect rows is 4, but actually is $rows
  return -1
endi

print ================>td-4147
sql_error create table tx(ts timestamp, a1234_0123456789_0123456789_0123456789_0123456789_0123456789_0123456789 int)


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