diff --git a/src/client/src/tscSubquery.c b/src/client/src/tscSubquery.c index 380c43825547465079098870e3150dd6a2138b78..812027aa65bb3a4a2d35d630c2c8d112df9a7cc0 100644 --- a/src/client/src/tscSubquery.c +++ b/src/client/src/tscSubquery.c @@ -683,10 +683,14 @@ void tscBuildVgroupTableInfo(SSqlObj* pSql, STableMetaInfo* pTableMetaInfo, SArr prev = tt; } - pTableMetaInfo->pVgroupTables = result; pTableMetaInfo->vgroupIndex = 0; + + if (taosArrayGetSize(result) <= 0) { + pTableMetaInfo->pVgroupTables = NULL; + taosArrayDestroy(result); + } else { + pTableMetaInfo->pVgroupTables = result; - if (taosArrayGetSize(result) > 0) { SVgroupTableInfo* g = taosArrayGet(result, taosArrayGetSize(result) - 1); tscDebug("%p vgId:%d, tables:%"PRIzu, pSql, g->vgInfo.vgId, taosArrayGetSize(g->itemList)); }