From e69f59ba7769f5a7cd4db490cbcaa76fb47c0c9e Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Mon, 11 Jul 2022 17:38:09 +0800 Subject: [PATCH] fix: fix stmt rerun issue --- source/libs/parser/inc/parInsertData.h | 1 + source/libs/parser/src/parInsertData.c | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/source/libs/parser/inc/parInsertData.h b/source/libs/parser/inc/parInsertData.h index 167970838b..ea78735d5e 100644 --- a/source/libs/parser/inc/parInsertData.h +++ b/source/libs/parser/inc/parInsertData.h @@ -20,6 +20,7 @@ #include "os.h" #include "tname.h" #include "ttypes.h" +#include "query.h" #define IS_DATA_COL_ORDERED(spd) ((spd->orderStatus) == (int8_t)ORDER_STATUS_ORDERED) diff --git a/source/libs/parser/src/parInsertData.c b/source/libs/parser/src/parInsertData.c index 84bcef7185..290c65de12 100644 --- a/source/libs/parser/src/parInsertData.c +++ b/source/libs/parser/src/parInsertData.c @@ -630,6 +630,17 @@ int32_t qCloneStmtDataBlock(void** pDst, void* pSrc) { memcpy(*pDst, pSrc, sizeof(STableDataBlocks)); ((STableDataBlocks*)(*pDst))->cloned = true; + STableDataBlocks* pBlock = (STableDataBlocks*)(*pDst); + if (pBlock->pTableMeta) { + void *pNewMeta = taosMemoryMalloc(TABLE_META_SIZE(pBlock->pTableMeta)); + if (NULL == pNewMeta) { + taosMemoryFreeClear(*pDst); + return TSDB_CODE_OUT_OF_MEMORY; + } + memcpy(pNewMeta, pBlock->pTableMeta, TABLE_META_SIZE(pBlock->pTableMeta)); + pBlock->pTableMeta = pNewMeta; + } + return qResetStmtDataBlock(*pDst, false); }