TDengine/tests/script/tsim/insert/basic1.sim

104 lines
3 KiB
Text
Raw Normal View History

2022-03-18 07:08:20 +00:00
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
sql connect
print =============== create database
sql create database d1
2022-08-11 12:26:40 +00:00
sql select * from information_schema.ins_databases
2022-04-14 03:36:06 +00:00
if $rows != 3 then
2022-03-18 07:08:20 +00:00
return -1
endi
print $data00 $data01 $data02
sql use d1
print =============== create super table, include all type
sql create table if not exists stb (ts timestamp, c1 bool, c2 tinyint, c3 smallint, c4 int, c5 bigint, c6 float, c7 double, c8 binary(16), c9 nchar(16), c10 timestamp, c11 tinyint unsigned, c12 smallint unsigned, c13 int unsigned, c14 bigint unsigned) tags (t1 bool, t2 tinyint, t3 smallint, t4 int, t5 bigint, t6 float, t7 double, t8 binary(16), t9 nchar(16), t10 timestamp, t11 tinyint unsigned, t12 smallint unsigned, t13 int unsigned, t14 bigint unsigned)
sql create stable if not exists stb_1 (ts timestamp, i int) tags (j int)
sql create table stb_2 (ts timestamp, i int) tags (j int)
sql create stable stb_3 (ts timestamp, i int) tags (j int)
sql show stables
2022-08-15 06:10:07 +00:00
if $rows != 4 then
2022-03-18 07:08:20 +00:00
return -1
endi
print =============== create child table
sql create table c1 using stb tags(true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40)
sql create table c2 using stb tags(false, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 2', 'child tbl 2', '2022-02-25 18:00:00.000', 10, 20, 30, 40)
sql show tables
2022-08-15 06:10:07 +00:00
if $rows != 2 then
2022-03-18 07:08:20 +00:00
return -1
endi
2022-03-28 13:24:59 +00:00
sql insert into c1 values(now-1s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40)
2022-03-18 07:08:20 +00:00
sql insert into c1 values(now+0s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) (now+1s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) (now+2s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40)
print =============== query data
sql select * from c1
2022-08-15 06:10:07 +00:00
print rows: $rows
2022-03-23 05:04:59 +00:00
print $data00 $data01
2022-08-15 06:10:07 +00:00
print $data10 $data11
2022-03-23 05:04:59 +00:00
print $data20 $data21
print $data30 $data31
2022-08-15 06:10:07 +00:00
if $rows != 4 then
2022-03-18 07:08:20 +00:00
return -1
endi
2022-03-24 03:43:39 +00:00
if $data01 != 1 then
print expect 1, actual: $data01
2022-03-18 07:08:20 +00:00
return -1
endi
2022-08-15 06:10:07 +00:00
if $data02 != -1 then
2022-03-18 07:08:20 +00:00
return -1
endi
2022-08-15 06:10:07 +00:00
if $data03 != -2 then
2022-03-18 07:08:20 +00:00
return -1
endi
2022-03-23 05:04:59 +00:00
print =============== query data from st, but not support select * from super table, waiting fix
2022-07-14 03:42:55 +00:00
sql select * from stb
2022-08-15 06:10:07 +00:00
if $rows != 4 then
2022-07-14 03:42:55 +00:00
return -1
endi
2022-03-18 07:08:20 +00:00
print =============== stop and restart taosd
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s start
print =============== query data
sql select * from c1
2022-08-15 06:10:07 +00:00
print rows: $rows
2022-03-23 05:04:59 +00:00
print $data00 $data01
2022-08-15 06:10:07 +00:00
print $data10 $data11
2022-03-23 05:04:59 +00:00
print $data20 $data21
print $data30 $data31
2022-08-15 06:10:07 +00:00
if $rows != 4 then
2022-03-18 07:08:20 +00:00
return -1
endi
2022-03-24 03:43:39 +00:00
if $data01 != 1 then
2022-03-18 07:08:20 +00:00
return -1
endi
2022-08-15 06:10:07 +00:00
if $data02 != -1 then
2022-03-18 07:08:20 +00:00
return -1
endi
2022-08-15 06:10:07 +00:00
if $data03 != -2 then
2022-03-18 07:08:20 +00:00
return -1
endi
2022-03-23 05:04:59 +00:00
print =============== query data from st, but not support select * from super table, waiting fix
2022-07-14 03:42:55 +00:00
sql select * from stb
2022-08-15 06:10:07 +00:00
if $rows != 4 then
2022-07-14 03:42:55 +00:00
return -1
endi
2022-03-23 05:04:59 +00:00
2022-03-18 07:08:20 +00:00
system sh/exec.sh -n dnode1 -s stop -x SIGINT