diff --git a/tests/script/general/parser/tbname_escape.sim b/tests/script/general/parser/tbname_escape.sim new file mode 100644 index 0000000000000000000000000000000000000000..40c900ec1a77e6b4f3e420bc58405e2bf46cebc7 --- /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