diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index b06a685c48..a45e4de4d8 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -5088,7 +5088,6 @@ static int32_t translateInsertProject(STranslateContext* pCxt, SInsertStmt* pIns SNode* pPrimaryKeyExpr = NULL; SNode* pBoundCol = NULL; SNode* pProj = NULL; - int16_t numOfSourcePKs = 0; int16_t numOfTargetPKs = 0; int16_t numOfBoundPKs = 0; FORBOTH(pBoundCol, pInsert->pCols, pProj, pProjects) { @@ -5107,7 +5106,6 @@ static int32_t translateInsertProject(STranslateContext* pCxt, SInsertStmt* pIns if (PRIMARYKEY_TIMESTAMP_COL_ID == pCol->colId) { pPrimaryKeyExpr = (SNode*)pExpr; numOfTargetPKs = pCol->numOfPKs; - numOfSourcePKs = ((SColumnNode*)pProj)->numOfPKs; } if (pCol->isPk) ++numOfBoundPKs; } @@ -5121,12 +5119,6 @@ static int32_t translateInsertProject(STranslateContext* pCxt, SInsertStmt* pIns return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, "Primary key column should not be none"); } - if (numOfTargetPKs < numOfSourcePKs) { - return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, - "Target table has less primary keys:%" PRIi16 " than source:%" PRIi16, - numOfTargetPKs, numOfSourcePKs); - } - return addOrderByPrimaryKeyToQuery(pCxt, pPrimaryKeyExpr, pInsert->pQuery); }