From 81d177d52d832adfe73756cd3f77963f1159a44f Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Mon, 25 Nov 2024 19:17:56 +0800 Subject: [PATCH] support subscript --- source/libs/parser/src/parTranslater.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index ebb6693508..b4452172d8 100755 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -15192,11 +15192,12 @@ static int32_t buildUpdateTagValReqImpl2(STranslateContext* pCxt, SAlterTableStm pReq->tagName = taosStrdup(colName); if (NULL == pReq->tagName) { - return terrno; + TAOS_CHECK_GOTO(terrno, NULL, _err); } + pReq->pTagArray = taosArrayInit(1, sizeof(STagVal)); if (NULL == pReq->pTagArray) { - return terrno; + TAOS_CHECK_GOTO(terrno, NULL, _err); } pReq->colId = pSchema->colId; pReq->tagType = pSchema->type; @@ -15246,7 +15247,11 @@ static int32_t buildUpdateTagValReqImpl2(STranslateContext* pCxt, SAlterTableStm } } } - +_err: + if (code != 0) { + taosArrayDestroy(pReq->pTagArray); + taosMemoryFree(pReq->tagName); + } return code; } static int32_t buildUpdateTagValReqImpl(STranslateContext* pCxt, SAlterTableStmt* pStmt, STableMeta* pTableMeta, @@ -15363,7 +15368,7 @@ static int32_t buildUpdateMultiTagValReq(STranslateContext* pCxt, SAlterTableStm SAlterTableStmt* pTagStmt = NULL; SNode* pNode = NULL; FOREACH(pNode, pNodeList) { - SMultiTagUpateVal val; + SMultiTagUpateVal val = {0}; pTagStmt = (SAlterTableStmt*)pNode; code = buildUpdateTagValReqImpl2(pCxt, pTagStmt, pTableMeta, pTagStmt->colName, &val); if (TSDB_CODE_SUCCESS != code) {