From 9ee0bd91409d628b855466f996314a32026fba78 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Mon, 15 Nov 2021 18:49:30 +0800 Subject: [PATCH] fix/TD-10933 fix error if alias name is invalidate --- src/client/src/tscSQLParser.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 32c5246089..073e0a54b0 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -2030,6 +2030,7 @@ int32_t validateSelectNodeList(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SArray* pS const char* msg7 = "not support distinct mixed with groupby"; const char* msg8 = "not support distinct in nest query"; const char* msg9 = "not support group by in block func"; + const char* msg10 = "invalid alias name"; // too many result columns not support order by in query if (taosArrayGetSize(pSelNodeList) > TSDB_MAX_COLUMNS) { @@ -2053,6 +2054,9 @@ int32_t validateSelectNodeList(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SArray* pS hasDistinct = (pItem->distinct == true); distIdx = hasDistinct ? i : -1; } + if(pItem->aliasName != NULL && validateColumnName(pItem->aliasName) != TSDB_CODE_SUCCESS){ + return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg10); + } int32_t type = pItem->pNode->type; if (type == SQL_NODE_SQLFUNCTION) { -- GitLab