Merge pull request #22043 from taosdata/fix/TD-25169
fix: report permission error when all columns are invisiable
This commit is contained in:
commit
83dbc9be6c
|
@ -58,6 +58,7 @@ typedef struct SParseContext {
|
||||||
bool isSuperUser;
|
bool isSuperUser;
|
||||||
bool enableSysInfo;
|
bool enableSysInfo;
|
||||||
bool async;
|
bool async;
|
||||||
|
bool hasInvisibleCol;
|
||||||
const char* svrVer;
|
const char* svrVer;
|
||||||
bool nodeOffline;
|
bool nodeOffline;
|
||||||
SArray* pTableMetaPos; // sql table pos => catalog data pos
|
SArray* pTableMetaPos; // sql table pos => catalog data pos
|
||||||
|
|
|
@ -878,6 +878,7 @@ static int32_t createColumnsByTable(STranslateContext* pCxt, const STableNode* p
|
||||||
(igTags ? 0 : ((TSDB_SUPER_TABLE == pMeta->tableType) ? pMeta->tableInfo.numOfTags : 0));
|
(igTags ? 0 : ((TSDB_SUPER_TABLE == pMeta->tableType) ? pMeta->tableInfo.numOfTags : 0));
|
||||||
for (int32_t i = 0; i < nums; ++i) {
|
for (int32_t i = 0; i < nums; ++i) {
|
||||||
if (invisibleColumn(pCxt->pParseCxt->enableSysInfo, pMeta->tableType, pMeta->schema[i].flags)) {
|
if (invisibleColumn(pCxt->pParseCxt->enableSysInfo, pMeta->tableType, pMeta->schema[i].flags)) {
|
||||||
|
pCxt->pParseCxt->hasInvisibleCol = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
SColumnNode* pCol = (SColumnNode*)nodesMakeNode(QUERY_NODE_COLUMN);
|
SColumnNode* pCol = (SColumnNode*)nodesMakeNode(QUERY_NODE_COLUMN);
|
||||||
|
@ -3203,8 +3204,12 @@ static int32_t translateSelectList(STranslateContext* pCxt, SSelectStmt* pSelect
|
||||||
code = translateFillValues(pCxt, pSelect);
|
code = translateFillValues(pCxt, pSelect);
|
||||||
}
|
}
|
||||||
if (NULL == pSelect->pProjectionList || 0 >= pSelect->pProjectionList->length) {
|
if (NULL == pSelect->pProjectionList || 0 >= pSelect->pProjectionList->length) {
|
||||||
|
if (pCxt->pParseCxt->hasInvisibleCol) {
|
||||||
|
code = TSDB_CODE_PAR_PERMISSION_DENIED;
|
||||||
|
} else {
|
||||||
code = TSDB_CODE_PAR_INVALID_SELECTED_EXPR;
|
code = TSDB_CODE_PAR_INVALID_SELECTED_EXPR;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue