fix: error msg of show tags from ntb/view

This commit is contained in:
kailixu 2024-05-14 12:49:09 +08:00
parent 0ae8926e69
commit ba8d44e49c
2 changed files with 14 additions and 2 deletions

View File

@ -11875,11 +11875,18 @@ static int32_t checkShowTags(STranslateContext* pCxt, const SShowStmt* pShow) {
toName(pCxt->pParseCxt->acctId, ((SValueNode*)pShow->pDbName)->literal,
((SValueNode*)pShow->pTbName)->literal, &name),
&pTableMeta, true);
taosMemoryFreeClear(pTableMeta);
if (TSDB_CODE_SUCCESS != code) {
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_GET_META_ERROR, tstrerror(code));
code = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_GET_META_ERROR, tstrerror(code));
goto _exit;
}
if (TSDB_SUPER_TABLE != pTableMeta->tableType && TSDB_CHILD_TABLE != pTableMeta->tableType) {
code = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_TAGS_PC,
"The _TAGS pseudo column can only be used for child table and super table queries");
goto _exit;
}
_exit:
taosMemoryFreeClear(pTableMeta);
return code;
}

View File

@ -121,6 +121,11 @@ class TDTestCase:
tdSql.error(f'show tags from tb_undef from db', expectErrInfo='Fail to get table info, error: Table does not exist')
tdSql.error(f'show tags from db.tb_undef', expectErrInfo='Fail to get table info, error: Table does not exist')
tdSql.error(f'show tags from tb_undef', expectErrInfo='Fail to get table info, error: Table does not exist')
tdSql.error(f'show tags from ntb', expectErrInfo='Tags can only applied to super table and child table')
tdSql.error(f'show tags from vtb', expectErrInfo='Tags can only applied to super table and child table')
tdSql.error(f'show tags from vtb1', expectErrInfo='Tags can only applied to super table and child table')
tdSql.error(f'show tags from vtb2', expectErrInfo='Tags can only applied to super table and child table')
tdSql.error(f'show tags from vtbn', expectErrInfo='Tags can only applied to super table and child table')
# show table tags
tdSql.query(f'show table tags from stb')