From f9a6243859032e210f9b927abea175a683604096 Mon Sep 17 00:00:00 2001 From: slzhou Date: Mon, 25 Mar 2024 09:38:50 +0800 Subject: [PATCH] fix: add pk col after ts col to make operator of show table distributed super_table work --- source/libs/planner/src/planLogicCreater.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/libs/planner/src/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c index c1793bfb90..c79fbd01f0 100644 --- a/source/libs/planner/src/planLogicCreater.c +++ b/source/libs/planner/src/planLogicCreater.c @@ -341,10 +341,11 @@ static int32_t addDefaultScanCol(const STableMeta* pMeta, SNodeList** pCols) { if (TSDB_SYSTEM_TABLE == pMeta->tableType) { return addSystableFirstCol(pMeta->uid, pMeta->schema, pCols, pMeta); } - if (hasPkInTable(pMeta)) { - addPkCol(pMeta->uid, pMeta->schema + 1, pCols, pMeta); + int32_t code = addPrimaryKeyCol(pMeta->uid, pMeta->schema, pCols, pMeta); + if (code == TSDB_CODE_SUCCESS && hasPkInTable(pMeta)) { + code = addPkCol(pMeta->uid, pMeta->schema + 1, pCols, pMeta); } - return addPrimaryKeyCol(pMeta->uid, pMeta->schema, pCols, pMeta); + return code; } static int32_t makeScanLogicNode(SLogicPlanContext* pCxt, SRealTableNode* pRealTable, bool hasRepeatScanFuncs,