From 1251245c2a2c42388dddfd152bb3cec910cc5245 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Mon, 24 Apr 2023 09:49:03 +0800 Subject: [PATCH] move code to parser --- source/libs/parser/src/parTranslater.c | 5 +++++ source/libs/planner/src/planLogicCreater.c | 6 +----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index b44c36dde1..52451d35a8 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -3792,6 +3792,11 @@ static int32_t translateDeleteWhere(STranslateContext* pCxt, SDeleteStmt* pDelet } static int32_t translateDelete(STranslateContext* pCxt, SDeleteStmt* pDelete) { + // check delete from system tables + if (isSystemDb(((SRealTableNode*)pDelete->pFromTable)->table.dbName)) { + return TSDB_CODE_TSC_INVALID_OPERATION; + } + pCxt->pCurrStmt = (SNode*)pDelete; int32_t code = translateFrom(pCxt, pDelete->pFromTable); if (TSDB_CODE_SUCCESS == code) { diff --git a/source/libs/planner/src/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c index 9e03095d2e..39783868b3 100644 --- a/source/libs/planner/src/planLogicCreater.c +++ b/source/libs/planner/src/planLogicCreater.c @@ -1442,12 +1442,8 @@ 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) { -- GitLab