From 546019bfa5288a254d37fcf140d45f1096023758 Mon Sep 17 00:00:00 2001 From: shenglian zhou Date: Thu, 9 Sep 2021 08:55:04 +0800 Subject: [PATCH] [TD-6561]:regexp -add nmatch relation operator --- src/client/src/tscSQLParser.c | 2 +- tests/script/general/parser/regex.sim | 29 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index e9eee4ad49..dff50ae1cf 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -4513,7 +4513,7 @@ static int32_t validateLikeExpr(tSqlExpr* pExpr, STableMeta* pTableMeta, int32_t // check for match expression static int32_t validateMatchExpr(tSqlExpr* pExpr, STableMeta* pTableMeta, int32_t index, char* msgBuf) { const char* msg1 = "regular expression string should be less than %d characters"; - const char* msg2 = "illegal column type for match"; + const char* msg2 = "illegal column type for match/nmatch"; const char* msg3 = "invalid regular expression"; tSqlExpr* pLeft = pExpr->pLeft; diff --git a/tests/script/general/parser/regex.sim b/tests/script/general/parser/regex.sim index 2c79a2ab0d..025649da64 100644 --- a/tests/script/general/parser/regex.sim +++ b/tests/script/general/parser/regex.sim @@ -79,6 +79,35 @@ if $rows != 1 then return -1 endi +sql create table wrong_type(ts timestamp, c0 tinyint, c1 smallint, c2 int, c3 bigint, c4 float, c5 double, c6 bool) tags(t0 tinyint, t1 smallint, t2 int, t3 bigint, t4 float, t5 double, t6 bool) +sql insert into wrong_type_1 using wrong_type tags(1, 2, 3, 4, 5, 6, true) values(now, 1, 2, 3, 4, 5, 6, false) +sql_error select * from wrong_type where ts match '.*' +sql_error select * from wrong_type where ts nmatch '.*' +sql_error select * from wrong_type where c0 match '.*' +sql_error select * from wrong_type where c0 nmatch '.*' +sql_error select * from wrong_type where c1 match '.*' +sql_error select * from wrong_type where c1 nmatch '.*' +sql_error select * from wrong_type where c2 match '.*' +sql_error select * from wrong_type where c2 nmatch '.*' +sql_error select * from wrong_type where c3 match '.*' +sql_error select * from wrong_type where c3 nmatch '.*' +sql_error select * from wrong_type where c4 match '.*' +sql_error select * from wrong_type where c4 nmatch '.*' +sql_error select * from wrong_type where c5 match '.*' +sql_error select * from wrong_type where c6 nmatch '.*' +sql_error select * from wrong_type where t1 match '.*' +sql_error select * from wrong_type where t1 nmatch '.*' +sql_error select * from wrong_type where t2 match '.*' +sql_error select * from wrong_type where t2 match '.*' +sql_error select * from wrong_type where t3 match '.*' +sql_error select * from wrong_type where t3 match '.*' +sql_error select * from wrong_type where t4 match '.*' +sql_error select * from wrong_type where t4 match '.*' +sql_error select * from wrong_type where t5 nmatch '.*' +sql_error select * from wrong_type where t5 nmatch '.*' +sql_error select * from wrong_type where t6 nmatch '.*' +sql_error select * from wrong_type where t6 nmatch '.*' + system sh/exec.sh -n dnode1 -s stop -x SIGINT