提交 c5b37377 编写于 作者: G Ganlin Zhao

fix: forbid delete from system table

上级 0993510d
...@@ -77,6 +77,7 @@ void getInfosDbMeta(const SSysTableMeta** pInfosTableMeta, size_t* size); ...@@ -77,6 +77,7 @@ void getInfosDbMeta(const SSysTableMeta** pInfosTableMeta, size_t* size);
void getPerfDbMeta(const SSysTableMeta** pPerfsTableMeta, size_t* size); void getPerfDbMeta(const SSysTableMeta** pPerfsTableMeta, size_t* size);
void getVisibleInfosTablesNum(bool sysInfo, size_t* size); void getVisibleInfosTablesNum(bool sysInfo, size_t* size);
bool invisibleColumn(bool sysInfo, int8_t tableType, int8_t flags); bool invisibleColumn(bool sysInfo, int8_t tableType, int8_t flags);
bool isSystemDb(const char *dbName);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -448,3 +448,7 @@ bool invisibleColumn(bool sysInfo, int8_t tableType, int8_t flags) { ...@@ -448,3 +448,7 @@ bool invisibleColumn(bool sysInfo, int8_t tableType, int8_t flags) {
} }
return 0 != (flags & COL_IS_SYSINFO); 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 ...@@ -1442,8 +1442,12 @@ static int32_t createDeleteRootLogicNode(SLogicPlanContext* pCxt, SDeleteStmt* p
} }
static int32_t createDeleteScanLogicNode(SLogicPlanContext* pCxt, SDeleteStmt* pDelete, SLogicNode** pLogicNode) { 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; 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 // set columns to scan
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册