diff --git a/source/libs/parser/src/parInsertSql.c b/source/libs/parser/src/parInsertSql.c index 3fbe23592a..5b0b5acf2b 100644 --- a/source/libs/parser/src/parInsertSql.c +++ b/source/libs/parser/src/parInsertSql.c @@ -1492,6 +1492,7 @@ static void resetEnvPreTable(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStm pStmt->pBoundCols = NULL; pStmt->usingTableProcessing = false; pStmt->fileProcessing = false; + pStmt->usingTableName.type = 0; } // input pStmt->pSql: [(field1_name, ...)] [ USING ... ] VALUES ... | FILE ... @@ -1539,6 +1540,10 @@ static int32_t checkTableClauseFirstToken(SInsertParseContext* pCxt, SVnodeModif } } + if (TK_NK_ID != pTbName->type && TK_NK_STRING != pTbName->type) { + return buildSyntaxErrMsg(&pCxt->msg, "table_name is expected", pTbName->z); + } + *pHasData = true; return TSDB_CODE_SUCCESS; }