diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 35d6d23a83a35e0e6b4e4bfb7e8d99d7fdcc64ed..9746f79d9ae51845c9b997929916b6f83a0cc140 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -4531,6 +4531,10 @@ static int32_t validateMatchExpr(tSqlExpr* pExpr, STableMeta* pTableMeta, int32_ return invalidOperationMsg(msgBuf, msg2); } + if (!(pRight->type == SQL_NODE_VALUE && pRight->value.nType == TSDB_DATA_TYPE_BINARY)) { + return invalidOperationMsg(msgBuf, msg3); + } + int errCode = 0; regex_t regex; char regErrBuf[256] = {0}; diff --git a/tests/script/general/parser/regex.sim b/tests/script/general/parser/regex.sim index 36b7ce99846f64baf96d4861c13c3b52b7cae9ad..eed36018d4c04ec5752e64105d025347982bfcb0 100644 --- a/tests/script/general/parser/regex.sim +++ b/tests/script/general/parser/regex.sim @@ -79,6 +79,9 @@ if $rows != 1 then return -1 endi +sql_error select c1b from $st_name where c1b match e; +sql_error select c1b from $st_name where c1b nmatch e; + sql create table wrong_type(ts timestamp, c0 tinyint, c1 smallint, c2 int, c3 bigint, c4 float, c5 double, c6 bool, c7 nchar(20)) tags(t0 tinyint, t1 smallint, t2 int, t3 bigint, t4 float, t5 double, t6 bool, t7 nchar(10)) sql insert into wrong_type_1 using wrong_type tags(1, 2, 3, 4, 5, 6, true, 'notsupport') values(now, 1, 2, 3, 4, 5, 6, false, 'notsupport') sql_error select * from wrong_type where ts match '.*'