From 08df84d6dc273d81e9dc310bc6241e783c94f237 Mon Sep 17 00:00:00 2001 From: wpan Date: Thu, 23 Sep 2021 08:56:28 +0800 Subject: [PATCH] add test case --- tests/script/general/parser/tbname_escape.sim | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 tests/script/general/parser/tbname_escape.sim diff --git a/tests/script/general/parser/tbname_escape.sim b/tests/script/general/parser/tbname_escape.sim new file mode 100644 index 0000000000..40c900ec1a --- /dev/null +++ b/tests/script/general/parser/tbname_escape.sim @@ -0,0 +1,81 @@ +system sh/stop_dnodes.sh + + +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 -c walLevel -v 1 +system sh/exec.sh -n dnode1 -s start + +sleep 100 +sql connect +print ======================== dnode1 start + +sql create database dbesc; + +sql use dbesc; + +sql_error create stable `dbesc`.stba (ts timestamp, f1 int) tags(t1 int); + +sql create stable `!.!.!` (ts timestamp, f1 int) tags(t1 int); +sql create stable 'st1' (ts timestamp, f1 int) tags(t1 int) ; +sql create table `.,@` (ts timestamp, f1 int); + +sql_error create table ',?,?,?' using dbesc.`!.!.!` tags(1); +sql_error create table `ab`` using dbesc.`!.!.!` tags(2); + +sql create table `,?,?,?` using dbesc.`!.!.!` tags(1); +sql create table `~!@#\$%^&*()_+|\][{}a,./<>?0` using dbesc.`!.!.!` tags(2); +sql_error create table 'tb1' using `dbesc`.`!.!.!` tags(2); + +sql create table 'tb2' using `!.!.!` tags(2); +sql create table 'tb3' using 'dbesc'.`!.!.!` tags(3); +sql create table 'tb4' using "dbesc".`!.!.!` tags(3); + +sql insert into 'tb5' using 'st1' tags (3) values ('2021-09-22 10:10:11', 1); +sql insert into dbesc.'tb6' using dbesc.'st1' tags (3) values ('2021-09-22 10:10:12', 2); + +sql insert into `.....` using `!.!.!` tags (3) values ('2021-09-22 10:10:13', 3); +sql insert into dbesc.`.....,` using dbesc.`!.!.!` tags (4) values ('2021-09-22 10:10:13', 4); +sql insert into "dbesc".`.....,,` using 'dbesc'.`!.!.!` tags (5) values ('2021-09-22 10:10:14', 5); + +sql_error insert into `dbesc`.`.....,,,` using 'dbesc'.`!.!.!` tags (6) values ('2021-09-22 10:10:15', 6); +sql_error insert into dbesc.`.....,,,` using `dbesc`.`!.!.!` tags (7) values ('2021-09-22 10:10:16', 7); + +sql insert into dbesc.`.....,,,1` using "dbesc".`!.!.!` tags (8) values ('2021-09-22 10:10:17', 8); + +sql select * from `.....`; +if $rows != 1 then + return -1 +endi +if $data00 != @21-09-22 10:10:13.000@ then + return -1 +endi + +sql select `.....`.* from `.....`; +if $rows != 1 then + return -1 +endi +if $data00 != @21-09-22 10:10:13.000@ then + return -1 +endi + +sql select `.....`.*, `.....,`.* from `.....`,`.....,` where `.....`.ts=`.....,`.ts; +if $rows != 1 then + return -1 +endi +if $data00 != @21-09-22 10:10:13.000@ then + return -1 +endi + +sql select a.*, b.* from `.....` a,`.....,` b where a.ts=b.ts; +if $rows != 1 then + return -1 +endi +if $data00 != @21-09-22 10:10:13.000@ then + return -1 +endi + +sql select * from `!.!.!` where tbname = `.....`; + +sql SHOW CREATE TABLE `.....`; + +system sh/exec.sh -n dnode1 -s stop -x SIGINT -- GitLab