未验证 提交 7b1cd8ba 编写于 作者: D dapan1121 提交者: GitHub

Merge pull request #7905 from taosdata/hotfix/td-6634

[TD-6634]<hotfix>:use original string and remove begin/end quote instead of string value after stringRmQuote
...@@ -4399,7 +4399,16 @@ static int32_t validateMatchExpr(tSqlExpr* pExpr, STableMeta* pTableMeta, int32_ ...@@ -4399,7 +4399,16 @@ static int32_t validateMatchExpr(tSqlExpr* pExpr, STableMeta* pTableMeta, int32_
regex_t regex; regex_t regex;
char regErrBuf[256] = {0}; char regErrBuf[256] = {0};
const char* pattern = pRight->value.pz; //remove the quote at the begin end of original sql string.
uint32_t lenPattern = pRight->exprToken.n - 2;
char* pattern = malloc(lenPattern + 1);
strncpy(pattern, pRight->exprToken.z+1, lenPattern);
pattern[lenPattern] = '\0';
tfree(pRight->value.pz);
pRight->value.pz = pattern;
pRight->value.nLen = lenPattern;
int cflags = REG_EXTENDED; int cflags = REG_EXTENDED;
if ((errCode = regcomp(&regex, pattern, cflags)) != 0) { if ((errCode = regcomp(&regex, pattern, cflags)) != 0) {
regerror(errCode, &regex, regErrBuf, sizeof(regErrBuf)); regerror(errCode, &regex, regErrBuf, sizeof(regErrBuf));
......
...@@ -79,6 +79,23 @@ if $rows != 1 then ...@@ -79,6 +79,23 @@ if $rows != 1 then
return -1 return -1
endi endi
sql select c1b from $st_name where c1b match '\\.\\*'
if $rows != 0 then
return -1
endi
sql select c1b from $st_name where c1b match '\\\\'
if $rows != 0 then
return -1
endi
sql insert into $ct1_name values(now+3s, '\\this is engine')
sql select c1b from $st_name where c1b match '\\'
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 match e;
sql_error select c1b from $st_name where c1b nmatch e; sql_error select c1b from $st_name where c1b nmatch e;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册