提交 b8a4df41 编写于 作者: wmmhello's avatar wmmhello

fix:avoid put tag to select if where condition is always true or false

上级 689ee055
...@@ -5899,15 +5899,15 @@ static int32_t checkCollectTopicTags(STranslateContext* pCxt, SCreateTopicStmt* ...@@ -5899,15 +5899,15 @@ static int32_t checkCollectTopicTags(STranslateContext* pCxt, SCreateTopicStmt*
nodesDestroyList(colCxt.pTags); nodesDestroyList(colCxt.pTags);
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, "Columns are forbidden in where clause"); return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, "Columns are forbidden in where clause");
} }
if (NULL == colCxt.pTags) { if (NULL == colCxt.pTags) { // put one column to select
for (int32_t i = 0; i < pMeta->tableInfo.numOfTags; ++i) { // for (int32_t i = 0; i < pMeta->tableInfo.numOfColumns; ++i) {
SSchema* tag = &pMeta->schema[pMeta->tableInfo.numOfColumns + i]; SSchema* column = &pMeta->schema[0];
SColumnNode* col = (SColumnNode*)nodesMakeNode(QUERY_NODE_COLUMN); 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.aliasName, col->colName);
strcpy(col->node.userAlias, col->colName); strcpy(col->node.userAlias, col->colName);
addTagList(&colCxt.pTags, (SNode*)col); addTagList(&colCxt.pTags, (SNode*)col);
} // }
} }
*ppProjection = colCxt.pTags; *ppProjection = colCxt.pTags;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册