提交 8b944e21 编写于 作者: X xywang

fix: table name which is a key word led to a crash

上级 b8552bca
......@@ -1511,6 +1511,7 @@ int32_t tscSetTableFullName(SName* pName, SStrToken* pTableName, SSqlObj* pSql,
const char* msg4 = "db name too long";
const char* msg5 = "table name too long";
const char* msg6 = "table name empty";
const char* msg7 = "invalid table name";
SSqlCmd* pCmd = &pSql->cmd;
int32_t code = TSDB_CODE_SUCCESS;
......@@ -1575,6 +1576,15 @@ int32_t tscSetTableFullName(SName* pName, SStrToken* pTableName, SSqlObj* pSql,
}
}
if (code != 0) {
return code;
}
bool ret = taosIsKeyWordToken(pName->tname, (int32_t) strlen(pName->tname));
if (ret) {
code = invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg7);
}
return code;
}
......
......@@ -3014,6 +3014,10 @@ int32_t tscValidateName(SStrToken* pToken, bool escapeEnabled, bool *dbIncluded)
// single token, validate it
if (len == pToken->n) {
if (strncmp(pToken->z, "string", len) == 0) {
return TSDB_CODE_SUCCESS;
}
return validateQuoteToken(pToken, escapeEnabled, NULL);
} else {
sep = strnchr(pToken->z, TS_PATH_DELIMITER[0], pToken->n, true);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册