From b8a4df414699a94e0c4a2c775d101ae8df3c6123 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Tue, 30 May 2023 16:50:20 +0800 Subject: [PATCH] fix:avoid put tag to select if where condition is always true or false --- source/libs/parser/src/parTranslater.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 102b7479be..c10ee5d988 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -5899,15 +5899,15 @@ static int32_t checkCollectTopicTags(STranslateContext* pCxt, SCreateTopicStmt* nodesDestroyList(colCxt.pTags); return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, "Columns are forbidden in where clause"); } - if (NULL == colCxt.pTags) { - for (int32_t i = 0; i < pMeta->tableInfo.numOfTags; ++i) { - SSchema* tag = &pMeta->schema[pMeta->tableInfo.numOfColumns + i]; + if (NULL == colCxt.pTags) { // put one column to select +// for (int32_t i = 0; i < pMeta->tableInfo.numOfColumns; ++i) { + SSchema* column = &pMeta->schema[0]; SColumnNode* col = (SColumnNode*)nodesMakeNode(QUERY_NODE_COLUMN); - strcpy(col->colName, tag->name); + strcpy(col->colName, column->name); strcpy(col->node.aliasName, col->colName); strcpy(col->node.userAlias, col->colName); addTagList(&colCxt.pTags, (SNode*)col); - } +// } } *ppProjection = colCxt.pTags; -- GitLab