fix: error msg of show table tags from view

This commit is contained in:
kailixu 2024-05-14 12:25:25 +08:00
parent 3528c3c280
commit 4abe06627c
2 changed files with 17 additions and 7 deletions

View File

@ -4338,7 +4338,7 @@ int32_t translateTable(STranslateContext* pCxt, SNode** pTable, SNode* pJoinPare
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_GET_META_ERROR, tstrerror(code));
}
#ifdef TD_ENTERPRISE
if (TSDB_VIEW_TABLE == pRealTable->pMeta->tableType) {
if (TSDB_VIEW_TABLE == pRealTable->pMeta->tableType && !pCurrSmt->tagScan) {
return translateView(pCxt, pTable, &name);
}
translateAudit(pCxt, pRealTable, &name);

View File

@ -78,6 +78,11 @@ class TDTestCase:
tdSql.execute(f'create table stb (ts timestamp, c0 int) tags (t0 int, t1 int)')
tdSql.execute(f'create table ctb1 using stb tags (1, 1)')
tdSql.execute(f'create table ctb2 using stb tags (2, 2)')
tdSql.execute(f'create table ntb (ts timestamp, c0 int)')
tdSql.execute(f'create view vtb as select * from stb')
tdSql.execute(f'create view vtb1 as select * from ctb1')
tdSql.execute(f'create view vtb2 as select * from ctb2')
tdSql.execute(f'create view vtbn as select * from ntb')
tdSql.execute(f'insert into ctb1 values (now, 1)')
tdSql.execute(f'insert into ctb2 values (now, 2)')
@ -113,9 +118,9 @@ class TDTestCase:
tdSql.error(f'show tags from `db`.`stb` from db')
tdSql.error(f'show tags from db.ctb1 from db')
tdSql.error(f'show tags from `db`.`ctb1` from db')
tdSql.error(f'show tags from tb_undef from db')
tdSql.error(f'show tags from db.tb_undef')
tdSql.error(f'show tags from tb_undef')
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')
# show table tags
tdSql.query(f'show table tags from stb')
@ -148,9 +153,14 @@ class TDTestCase:
tdSql.error(f'show table tags from `db`.`stb` from db')
tdSql.error(f'show table tags from db.ctb1 from db')
tdSql.error(f'show table tags from `db`.`ctb1` from db')
tdSql.error(f'show table tags from tb_undef from db')
tdSql.error(f'show table tags from db.tb_undef')
tdSql.error(f'show table tags from tb_undef')
tdSql.error(f'show table tags from tb_undef from db', expectErrInfo='Fail to get table info, error: Table does not exist')
tdSql.error(f'show table tags from db.tb_undef', expectErrInfo='Fail to get table info, error: Table does not exist')
tdSql.error(f'show table tags from tb_undef', expectErrInfo='Fail to get table info, error: Table does not exist')
tdSql.error(f'show table tags from ntb', expectErrInfo='Tags can only applied to super table and child table')
tdSql.error(f'show table tags from vtb', expectErrInfo='Tags can only applied to super table and child table')
tdSql.error(f'show table tags from vtb1', expectErrInfo='Tags can only applied to super table and child table')
tdSql.error(f'show table tags from vtb2', expectErrInfo='Tags can only applied to super table and child table')
tdSql.error(f'show table tags from vtbn', expectErrInfo='Tags can only applied to super table and child table')
# show indexes
tdSql.execute(f'create index idx1 on stb (t1)')