fix: forbid delete from system table
This commit is contained in:
parent
0993510d91
commit
c5b3737702
|
@ -77,6 +77,7 @@ void getInfosDbMeta(const SSysTableMeta** pInfosTableMeta, size_t* size);
|
|||
void getPerfDbMeta(const SSysTableMeta** pPerfsTableMeta, size_t* size);
|
||||
void getVisibleInfosTablesNum(bool sysInfo, size_t* size);
|
||||
bool invisibleColumn(bool sysInfo, int8_t tableType, int8_t flags);
|
||||
bool isSystemDb(const char *dbName);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -448,3 +448,7 @@ bool invisibleColumn(bool sysInfo, int8_t tableType, int8_t flags) {
|
|||
}
|
||||
return 0 != (flags & COL_IS_SYSINFO);
|
||||
}
|
||||
|
||||
bool isSystemDb(const char *dbName) {
|
||||
return ((strcasecmp(dbName, TSDB_INFORMATION_SCHEMA_DB) == 0) || (strcasecmp(dbName, TSDB_PERFORMANCE_SCHEMA_DB) == 0));
|
||||
}
|
||||
|
|
|
@ -1442,8 +1442,12 @@ static int32_t createDeleteRootLogicNode(SLogicPlanContext* pCxt, SDeleteStmt* p
|
|||
}
|
||||
|
||||
static int32_t createDeleteScanLogicNode(SLogicPlanContext* pCxt, SDeleteStmt* pDelete, SLogicNode** pLogicNode) {
|
||||
if (isSystemDb(((SRealTableNode*)pDelete->pFromTable)->table.dbName)) {
|
||||
return TSDB_CODE_TSC_INVALID_OPERATION;
|
||||
}
|
||||
|
||||
SScanLogicNode* pScan = NULL;
|
||||
int32_t code = makeScanLogicNode(pCxt, (SRealTableNode*)pDelete->pFromTable, false, (SLogicNode**)&pScan);
|
||||
int32_t code = makeScanLogicNode(pCxt, (SRealTableNode*)pDelete->pFromTable, false, (SLogicNode**)&pScan);
|
||||
|
||||
// set columns to scan
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
|
|
Loading…
Reference in New Issue