提交 def1a16f 编写于 作者: G Ganlin Zhao

[TD-10700]<enhance>: The escape char backstick can be used for both tag name and column name

上级 60cd0395
...@@ -6607,7 +6607,7 @@ int32_t validateColumnName(char* name) { ...@@ -6607,7 +6607,7 @@ int32_t validateColumnName(char* name) {
return validateColumnName(token.z); return validateColumnName(token.z);
} else if (token.type == TK_ID) { } else if (token.type == TK_ID) {
tscRmEscapeAndTrimToken(&token); strRmquoteEscape(name, token.n);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} else { } else {
if (isNumber(&token)) { if (isNumber(&token)) {
...@@ -7728,6 +7728,10 @@ int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo) { ...@@ -7728,6 +7728,10 @@ int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo) {
tscDequoteAndTrimToken(sToken); tscDequoteAndTrimToken(sToken);
} }
if (TK_ID == sToken->type) {
tscRmEscapeAndTrimToken(sToken);
}
tVariantListItem* pItem = taosArrayGet(pValList, i); tVariantListItem* pItem = taosArrayGet(pValList, i);
findColumnIndex = false; findColumnIndex = false;
......
...@@ -91,6 +91,7 @@ int32_t strRmquoteEscape(char *z, int32_t len) { ...@@ -91,6 +91,7 @@ int32_t strRmquoteEscape(char *z, int32_t len) {
return strRmquote(z, len); return strRmquote(z, len);
} else if (len > 1 && z[0] == TS_ESCAPE_CHAR && z[len - 1] == TS_ESCAPE_CHAR) { } else if (len > 1 && z[0] == TS_ESCAPE_CHAR && z[len - 1] == TS_ESCAPE_CHAR) {
memmove(z, z + 1, len - 2); memmove(z, z + 1, len - 2);
z[len - 2] = '\0';
return len - 2; return len - 2;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册