diff --git a/src/backend/executor/execAmi.c b/src/backend/executor/execAmi.c
index 129daac0a1b7..3caa699c801f 100644
--- a/src/backend/executor/execAmi.c
+++ b/src/backend/executor/execAmi.c
@@ -24,6 +24,7 @@
#include "executor/nodeDynamicBitmapIndexscan.h"
#include "executor/nodeBitmapOr.h"
#include "executor/nodeCtescan.h"
+#include "executor/nodeDML.h"
#include "executor/nodeForeignscan.h"
#include "executor/nodeFunctionscan.h"
#include "executor/nodeHash.h"
@@ -619,6 +620,10 @@ ExecSquelchNode(PlanState *node)
ExecSquelchModifyTable((ModifyTableState *) node);
return;
+ case T_DMLState:
+ ExecSquelchDML((DMLState *) node);
+ return;
+
/*
* Node types that need custom code to recurse.
*/
diff --git a/src/backend/executor/nodeDML.c b/src/backend/executor/nodeDML.c
index af912775e12d..fb5f76b5c766 100644
--- a/src/backend/executor/nodeDML.c
+++ b/src/backend/executor/nodeDML.c
@@ -36,6 +36,26 @@ ExecDMLExplainEnd(PlanState *planstate, struct StringInfoData *buf)
planstate->instrument->execmemused += DML_MEM;
}
+/*
+ * Edit input attr numbers of projection using attributes map
+ */
+void
+RemapProjection(ProjectionInfo *projInfo, AttrMap *map)
+{
+ int *varNumbers = projInfo->pi_varNumbers;
+ int numSimpleVars = projInfo->pi_numSimpleVars;
+
+ for (int i = 0; i < numSimpleVars;++i)
+ varNumbers[i] = attrMap(map, varNumbers[i]);
+
+ if (projInfo->pi_lastInnerVar > 0)
+ projInfo->pi_lastInnerVar = attrMap(map, projInfo->pi_lastInnerVar);
+ if (projInfo->pi_lastOuterVar > 0)
+ projInfo->pi_lastOuterVar = attrMap(map, projInfo->pi_lastOuterVar);
+ if (projInfo->pi_lastScanVar > 0)
+ projInfo->pi_lastScanVar = attrMap(map, projInfo->pi_lastScanVar);
+}
+
/*
* Executes INSERT and DELETE DML operations. The
* action is specified within the TupleTableSlot at
@@ -45,158 +65,199 @@ ExecDMLExplainEnd(PlanState *planstate, struct StringInfoData *buf)
TupleTableSlot*
ExecDML(DMLState *node)
{
+ for (;;)
+ {
+ PlanState *outerNode = outerPlanState(node);
+ DML *plannode = (DML *) node->ps.plan;
- PlanState *outerNode = outerPlanState(node);
- DML *plannode = (DML *) node->ps.plan;
-
- Assert(outerNode != NULL);
+ Assert(outerNode != NULL);
- TupleTableSlot *slot = ExecProcNode(outerNode);
+ /* Temporary restore result tuple slot for use in next projection */
+ TupleTableSlot *returningResultTuple = node->ps.ps_ResultTupleSlot;
+ node->ps.ps_ResultTupleSlot = node->resultTupleSlot;
- if (TupIsNull(slot))
- {
- return NULL;
- }
+ /* Set target list for projection */
+ List *returningTargetList = plannode->plan.targetlist;
+ plannode->plan.targetlist = plannode->targetListProj;
- bool isnull = false;
- int action = DatumGetUInt32(slot_getattr(slot, plannode->actionColIdx, &isnull));
- Assert(!isnull);
+ TupleTableSlot *slot = ExecProcNode(outerNode);
+ TupleTableSlot *resultSlot = NULL;
- bool isUpdate = false;
- if (node->ps.state->es_plannedstmt->commandType == CMD_UPDATE)
- {
- isUpdate = true;
- }
+ if (TupIsNull(slot))
+ {
+ return NULL;
+ }
- Assert(action == DML_INSERT || action == DML_DELETE);
+ bool isnull = false;
+ int action = DatumGetUInt32(slot_getattr(slot, plannode->actionColIdx, &isnull));
+ Assert(!isnull);
+ bool isUpdate = false;
+ if (node->ps.state->es_plannedstmt->commandType == CMD_UPDATE)
+ {
+ isUpdate = true;
+ }
- /*
- * Reset per-tuple memory context to free any expression evaluation
- * storage allocated in the previous tuple cycle.
- */
- ExprContext *econtext = node->ps.ps_ExprContext;
- ResetExprContext(econtext);
+ Assert(action == DML_INSERT || action == DML_DELETE);
- /* Prepare cleaned-up tuple by projecting it and filtering junk columns */
- econtext->ecxt_outertuple = slot;
- TupleTableSlot *projectedSlot = ExecProject(node->ps.ps_ProjInfo, NULL);
+ /*
+ * Reset per-tuple memory context to free any expression evaluation
+ * storage allocated in the previous tuple cycle.
+ */
+ ExprContext *econtext = node->ps.ps_ExprContext;
+ ResetExprContext(econtext);
- /* remove 'junk' columns from tuple */
- node->cleanedUpSlot = ExecFilterJunk(node->junkfilter, projectedSlot);
+ /* Prepare cleaned-up tuple by projecting it and filtering junk columns */
+ econtext->ecxt_outertuple = slot;
+ TupleTableSlot *projectedSlot = ExecProject(node->ps.ps_ProjInfo, NULL);
- /*
- * If we are modifying a leaf partition we have to ensure that partition
- * selection operation will consider leaf partition's attributes as
- * coherent with root partition's attribute numbers, because partition
- * selection is performed using root's attribute numbers (all partition
- * rules are based on the parent relation's tuple descriptor). In case
- * when child partition has different attribute numbers from root's due to
- * dropped columns, the partition selection may go wrong without extra
- * validation.
- */
- if (node->ps.state->es_result_partitions)
- {
- ResultRelInfo *relInfo = node->ps.state->es_result_relations;
+ /* remove 'junk' columns from tuple */
+ node->cleanedUpSlot = ExecFilterJunk(node->junkfilter, projectedSlot);
- /*
- * The DML is done on a leaf partition. In order to reuse the map,
- * it will be allocated at es_result_relations.
- */
- if (RelationGetRelid(relInfo->ri_RelationDesc) !=
- node->ps.state->es_result_partitions->part->parrelid &&
- action != DML_DELETE)
- makePartitionCheckMap(node->ps.state, relInfo);
+ /* restore returning result tuple and target list*/
+ node->ps.ps_ResultTupleSlot = returningResultTuple;
+ plannode->plan.targetlist = returningTargetList;
/*
- * DML node always performs partition selection, and if we want to
- * reuse the map built in makePartitionCheckMap, we are allowed to
- * reassign es_result_relation_info, because ExecInsert, ExecDelete
- * changes it with target partition anyway. Moreover, without
- * inheritance plan (ORCA never builds such plans) the
- * es_result_relations will contain the only relation.
- */
- node->ps.state->es_result_relation_info = relInfo;
- }
-
- if (DML_INSERT == action)
- {
- /* Respect any given tuple Oid when updating a tuple. */
- if (isUpdate && plannode->tupleoidColIdx != 0)
+ * If we are modifying a leaf partition we have to ensure that partition
+ * selection operation will consider leaf partition's attributes as
+ * coherent with root partition's attribute numbers, because partition
+ * selection is performed using root's attribute numbers (all partition
+ * rules are based on the parent relation's tuple descriptor). In case
+ * when child partition has different attribute numbers from root's due to
+ * dropped columns, the partition selection may go wrong without extra
+ * validation.
+ */
+ if (node->ps.state->es_result_partitions)
{
- Oid oid;
- HeapTuple htuple;
-
- isnull = false;
- oid = slot_getattr(slot, plannode->tupleoidColIdx, &isnull);
- htuple = ExecFetchSlotHeapTuple(node->cleanedUpSlot);
- Assert(htuple == node->cleanedUpSlot->PRIVATE_tts_heaptuple);
- HeapTupleSetOid(htuple, oid);
+ ResultRelInfo *relInfo = node->ps.state->es_result_relations;
+
+ /*
+ * The DML is done on a leaf partition. In order to reuse the map,
+ * it will be allocated at es_result_relations.
+ */
+ if (RelationGetRelid(relInfo->ri_RelationDesc) !=
+ node->ps.state->es_result_partitions->part->parrelid &&
+ action != DML_DELETE)
+ makePartitionCheckMap(node->ps.state, relInfo);
+
+ /*
+ * DML node always performs partition selection, and if we want to
+ * reuse the map built in makePartitionCheckMap, we are allowed to
+ * reassign es_result_relation_info, because ExecInsert, ExecDelete
+ * changes it with target partition anyway. Moreover, without
+ * inheritance plan (ORCA never builds such plans) the
+ * es_result_relations will contain the only relation.
+ */
+ node->ps.state->es_result_relation_info = relInfo;
}
- /*
- * The plan origin is required since ExecInsert performs different
- * actions depending on the type of plan (constraint enforcement and
- * triggers.)
- */
- ExecInsert(node->cleanedUpSlot,
- NULL,
- node->ps.state,
- node->canSetTag,
- PLANGEN_OPTIMIZER /* Plan origin */,
- isUpdate,
- InvalidOid);
- }
- else /* DML_DELETE */
- {
- int32 segid = GpIdentity.segindex;
- Datum ctid = slot_getattr(slot, plannode->ctidColIdx, &isnull);
- Oid tableoid = InvalidOid;
+ if (DML_INSERT == action)
+ {
+ /* Respect any given tuple Oid when updating a tuple. */
+ if (isUpdate && plannode->tupleoidColIdx != 0)
+ {
+ Oid oid;
+ HeapTuple htuple;
+
+ isnull = false;
+ oid = slot_getattr(slot, plannode->tupleoidColIdx, &isnull);
+ htuple = ExecFetchSlotHeapTuple(node->cleanedUpSlot);
+ Assert(htuple == node->cleanedUpSlot->PRIVATE_tts_heaptuple);
+ HeapTupleSetOid(htuple, oid);
+ }
+
+ /*
+ * The plan origin is required since ExecInsert performs different
+ * actions depending on the type of plan (constraint enforcement and
+ * triggers.)
+ */
+ resultSlot = ExecInsert(node->cleanedUpSlot,
+ NULL,
+ node->ps.state,
+ node->canSetTag,
+ PLANGEN_OPTIMIZER /* Plan origin */,
+ isUpdate,
+ InvalidOid);
+ }
+ else /* DML_DELETE */
+ {
+ int32 segid = GpIdentity.segindex;
+ Datum ctid = slot_getattr(slot, plannode->ctidColIdx, &isnull);
+ Oid tableoid = InvalidOid;
- Assert(!isnull);
+ Assert(!isnull);
- if (AttributeNumberIsValid(plannode->tableoidColIdx))
- {
- Datum dtableoid = slot_getattr(slot, plannode->tableoidColIdx, &isnull);
- tableoid = isnull ? InvalidOid : DatumGetObjectId(dtableoid);
+ if (AttributeNumberIsValid(plannode->tableoidColIdx))
+ {
+ Datum dtableoid = slot_getattr(slot, plannode->tableoidColIdx, &isnull);
+ tableoid = isnull ? InvalidOid : DatumGetObjectId(dtableoid);
+ }
+
+ /*
+ * If tableoid is valid, it means that we are executing UPDATE/DELETE
+ * on partitioned table (root partition). In order to avoid partition
+ * pruning in ExecDelete one can use tableoid to build target
+ * ResultRelInfo for the leaf partition.
+ */
+ if (OidIsValid(tableoid) && node->ps.state->es_result_partitions)
+ {
+ ProjectionInfo *projRet =
+ node->ps.state->es_result_relation_info->ri_projectReturning;
+
+ node->ps.state->es_result_relation_info =
+ targetid_get_partition(tableoid, node->ps.state, true);
+ ResultRelInfo *relInfo = node->ps.state->es_result_relation_info;
+
+ if (projRet != NULL && relInfo->ri_projectReturning == NULL)
+ {
+ // make linked copy of returning projection with separate remapped input attr numbers
+ relInfo->ri_projectReturning = makeNode(ProjectionInfo);
+
+ *relInfo->ri_projectReturning = *projRet;
+ relInfo->ri_projectReturning->pi_varNumbers =
+ (int *) palloc(projRet->pi_numSimpleVars * sizeof(int));
+ memcpy(relInfo->ri_projectReturning->pi_varNumbers, projRet->pi_varNumbers,
+ projRet->pi_numSimpleVars * sizeof(int));
+
+ RemapProjection(relInfo->ri_projectReturning, relInfo->ri_partInsertMap);
+ }
+ }
+
+ ItemPointer tupleid = (ItemPointer) DatumGetPointer(ctid);
+ ItemPointerData tuple_ctid = *tupleid;
+ tupleid = &tuple_ctid;
+
+ if (AttributeNumberIsValid(node->segid_attno))
+ {
+ segid = DatumGetInt32(slot_getattr(slot, node->segid_attno, &isnull));
+ Assert(!isnull);
+ }
+
+ /* Correct tuple count by ignoring deletes when splitting tuples. */
+ resultSlot = ExecDelete(tupleid,
+ segid,
+ NULL, /* GPDB_91_MERGE_FIXME: oldTuple? */
+ node->cleanedUpSlot,
+ NULL /* DestReceiver */,
+ node->ps.state,
+ isUpdate ? false : node->canSetTag, /* if "isUpdate",
+ ExecInsert() will be run after
+ ExecDelete() so canSetTag should be set
+ properly in ExecInsert(). */
+ PLANGEN_OPTIMIZER /* Plan origin */,
+ isUpdate);
}
/*
- * If tableoid is valid, it means that we are executing UPDATE/DELETE
- * on partitioned table (root partition). In order to avoid partition
- * pruning in ExecDelete one can use tableoid to build target
- * ResultRelInfo for the leaf partition.
+ * If we got a RETURNING result, return it to caller. We'll continue
+ * the work on next call.
*/
- if (OidIsValid(tableoid) && node->ps.state->es_result_partitions)
- node->ps.state->es_result_relation_info =
- targetid_get_partition(tableoid, node->ps.state, true);
-
- ItemPointer tupleid = (ItemPointer) DatumGetPointer(ctid);
- ItemPointerData tuple_ctid = *tupleid;
- tupleid = &tuple_ctid;
-
- if (AttributeNumberIsValid(node->segid_attno))
+ if (!TupIsNull(resultSlot))
{
- segid = DatumGetInt32(slot_getattr(slot, node->segid_attno, &isnull));
- Assert(!isnull);
+ return resultSlot;
}
-
- /* Correct tuple count by ignoring deletes when splitting tuples. */
- ExecDelete(tupleid,
- segid,
- NULL, /* GPDB_91_MERGE_FIXME: oldTuple? */
- node->cleanedUpSlot,
- NULL /* DestReceiver */,
- node->ps.state,
- isUpdate ? false : node->canSetTag, /* if "isUpdate",
- ExecInsert() will be run after
- ExecDelete() so canSetTag should be set
- properly in ExecInsert(). */
- PLANGEN_OPTIMIZER /* Plan origin */,
- isUpdate);
}
-
- return slot;
}
/**
@@ -206,12 +267,13 @@ DMLState*
ExecInitDML(DML *node, EState *estate, int eflags)
{
/* check for unsupported flags */
- Assert(!(eflags & (EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK | EXEC_FLAG_REWIND)));
+ Assert(!(eflags & (EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK)));
DMLState *dmlstate = makeNode(DMLState);
dmlstate->ps.plan = (Plan *)node;
dmlstate->ps.state = estate;
dmlstate->canSetTag = node->canSetTag;
+ dmlstate->resultTupleSlot = NULL;
/*
* Initialize es_result_relation_info, just like ModifyTable.
* GPDB_90_MERGE_FIXME: do we need to consolidate the ModifyTable and DML
@@ -222,6 +284,10 @@ ExecInitDML(DML *node, EState *estate, int eflags)
CmdType operation = estate->es_plannedstmt->commandType;
ResultRelInfo *resultRelInfo = estate->es_result_relation_info;
+ /* set target list with projection and save returning target list */
+ List *returningTargetList = node->plan.targetlist;
+ node->plan.targetlist = node->targetListProj;
+
ExecInitResultTupleSlot(estate, &dmlstate->ps);
dmlstate->ps.targetlist = (List *)
@@ -337,6 +403,37 @@ ExecInitDML(DML *node, EState *estate, int eflags)
}
}
+ /* Sort node reads this slot before dml gets executed, fill it here or leave empty */
+ dmlstate->resultTupleSlot = dmlstate->ps.ps_ResultTupleSlot;
+
+ /*
+ * Initialize RETURNING projections if needed.
+ */
+ if (returningTargetList)
+ {
+ TupleTableSlot *slot;
+
+ /* Initialize result tuple slot and assign its rowtype */
+ TupleDesc tupDesc = ExecTypeFromTL(returningTargetList, false);
+
+ /* Set up a slot for the output of the RETURNING projection(s) */
+ ExecInitResultTupleSlot(estate, &dmlstate->ps);
+ ExecAssignResultType(&dmlstate->ps, tupDesc);
+ slot = dmlstate->ps.ps_ResultTupleSlot;
+
+ List *rliststate = (List *) ExecInitExpr((Expr *) returningTargetList, &dmlstate->ps);
+ resultRelInfo->ri_projectReturning =
+ ExecBuildProjectionInfo(rliststate, dmlstate->ps.ps_ExprContext, slot,
+ resultRelInfo->ri_RelationDesc->rd_att);
+
+ /* Set up a tuple table slot for use for trigger output tuples */
+ if (estate->es_trig_tuple_slot == NULL)
+ estate->es_trig_tuple_slot = ExecInitExtraTupleSlot(estate);
+ }
+
+ /* restore returning target list */
+ node->plan.targetlist = returningTargetList;
+
return dmlstate;
}
@@ -348,9 +445,23 @@ ExecEndDML(DMLState *node)
ReleaseTupleDesc(node->junkfilter->jf_cleanTupType);
ExecFreeExprContext(&node->ps);
- ExecClearTuple(node->ps.ps_ResultTupleSlot);
+ if (node->ps.ps_ResultTupleSlot != NULL)
+ ExecClearTuple(node->ps.ps_ResultTupleSlot);
ExecClearTuple(node->cleanedUpSlot);
ExecEndNode(outerPlanState(node));
EndPlanStateGpmonPkt(&node->ps);
}
+
+void
+ExecSquelchDML(DMLState *node)
+{
+ /*
+ * DML nodes must run to completion when asked to Squelch so
+ * that we don't risk losing modifications which should be performed
+ * regardless of any LIMIT's or other forms for projections which could
+ * end up causing a squelch to happen.
+ */
+ while (ExecDML(node) != NULL);
+}
+
/* EOF */
diff --git a/src/backend/executor/nodeMotion.c b/src/backend/executor/nodeMotion.c
index 86de436ef3f6..e092a8b85543 100644
--- a/src/backend/executor/nodeMotion.c
+++ b/src/backend/executor/nodeMotion.c
@@ -279,7 +279,7 @@ execMotionSender(MotionState *node)
/* need refactor */
if (node->isExplictGatherMotion)
{
- numsegments = motion->plan.flow->numsegments;
+ numsegments = motion->plan.flow != NULL ? motion->plan.flow->numsegments : node->numInputSegs;
}
diff --git a/src/backend/executor/nodeSplitUpdate.c b/src/backend/executor/nodeSplitUpdate.c
index 32b89e7d19d3..ebc7012a7c17 100644
--- a/src/backend/executor/nodeSplitUpdate.c
+++ b/src/backend/executor/nodeSplitUpdate.c
@@ -173,7 +173,7 @@ SplitUpdateState*
ExecInitSplitUpdate(SplitUpdate *node, EState *estate, int eflags)
{
/* Check for unsupported flags */
- Assert(!(eflags & (EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK | EXEC_FLAG_REWIND)));
+ Assert(!(eflags & (EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK)));
bool has_oids;
diff --git a/src/backend/gpopt/translate/CCTEListEntry.cpp b/src/backend/gpopt/translate/CCTEListEntry.cpp
index f15e4284813f..dfa86ebce34b 100644
--- a/src/backend/gpopt/translate/CCTEListEntry.cpp
+++ b/src/backend/gpopt/translate/CCTEListEntry.cpp
@@ -45,9 +45,11 @@ CCTEListEntry::CCTEListEntry(CMemoryPool *mp, ULONG query_level,
#ifdef GPOS_DEBUG
BOOL result =
#endif
- m_cte_info->Insert(
- cte->ctename,
- GPOS_NEW(mp) SCTEProducerInfo(cte_producer, cte_query->targetList));
+ m_cte_info->Insert(cte->ctename,
+ GPOS_NEW(mp) SCTEProducerInfo(
+ cte_producer, cte_query->returningList != NULL
+ ? cte_query->returningList
+ : cte_query->targetList));
GPOS_ASSERT(result);
}
diff --git a/src/backend/gpopt/translate/CTranslatorDXLToPlStmt.cpp b/src/backend/gpopt/translate/CTranslatorDXLToPlStmt.cpp
index 0bd321cc028e..ae1f51404d51 100644
--- a/src/backend/gpopt/translate/CTranslatorDXLToPlStmt.cpp
+++ b/src/backend/gpopt/translate/CTranslatorDXLToPlStmt.cpp
@@ -80,6 +80,8 @@ CTranslatorDXLToPlStmt::CTranslatorDXLToPlStmt(
m_md_accessor(md_accessor),
m_dxl_to_plstmt_context(dxl_to_plstmt_context),
m_cmd_type(CMD_SELECT),
+ m_has_returning(false),
+ m_returning_dml_on_replicated(false),
m_is_tgt_tbl_distributed(false),
m_result_rel_list(NULL),
m_num_of_segments(num_of_segments),
@@ -263,6 +265,7 @@ CTranslatorDXLToPlStmt::GetPlannedStmtFromDXL(const CDXLNode *dxlnode,
m_dxl_to_plstmt_context->GetCurrentMotionId() - 1;
planned_stmt->commandType = m_cmd_type;
+ planned_stmt->hasReturning = m_has_returning;
GPOS_ASSERT(plan->nMotionNodes >= 0);
if (0 == plan->nMotionNodes && !m_is_tgt_tbl_distributed)
@@ -2282,6 +2285,14 @@ CTranslatorDXLToPlStmt::TranslateDXLMotion(
flow->flotype = FLOW_UNDEFINED;
}
+ if (m_returning_dml_on_replicated && input_segids_array->Size() == 1)
+ {
+ // we set locus type in child node in this case
+ // to filter doubling output on executor side
+ flow->locustype = CdbLocusType_Replicated;
+ }
+ m_returning_dml_on_replicated = false;
+
child_plan->flow = flow;
motion->motionID = m_dxl_to_plstmt_context->GetNextMotionId();
@@ -4170,8 +4181,9 @@ CTranslatorDXLToPlStmt::TranslateDXLDml(
rte->requiredPerms |= acl_mode;
m_dxl_to_plstmt_context->AddRTE(rte);
- CDXLNode *project_list_dxlnode = (*dml_dxlnode)[0];
- CDXLNode *child_dxlnode = (*dml_dxlnode)[1];
+ CDXLNode *project_list_output_dxlnode = (*dml_dxlnode)[0];
+ CDXLNode *project_list_dxlnode = (*dml_dxlnode)[1];
+ CDXLNode *child_dxlnode = (*dml_dxlnode)[2];
CDXLTranslateContext child_context(m_mp, false,
output_context->GetColIdToParamIdMap());
@@ -4189,6 +4201,19 @@ CTranslatorDXLToPlStmt::TranslateDXLDml(
NULL, // translate context for the base table
child_contexts, output_context);
+ // set targetlist as list of target entries to be computed for parent nodes
+ plan->targetlist =
+ TranslateDXLProjList(project_list_output_dxlnode, &base_table_context,
+ child_contexts, output_context);
+
+ m_has_returning = m_has_returning || plan->targetlist != NIL;
+
+ if (plan->targetlist != NIL &&
+ md_rel->GetRelDistribution() == IMDRelation::EreldistrReplicated)
+ {
+ m_returning_dml_on_replicated = true;
+ }
+
// Create target list with nulls if rel has dropped cols. DELETE may have
// empty target list if there no after trigger present. Skip creating in
// such case.
@@ -4238,7 +4263,8 @@ CTranslatorDXLToPlStmt::TranslateDXLDml(
GPOS_ASSERT(0 != dml->actionColIdx);
- plan->targetlist = dml_target_list;
+ // save targetlist for projection of results from outer nodes
+ dml->targetListProj = dml_target_list;
plan->lefttree = child_plan;
plan->nMotionNodes = child_plan->nMotionNodes;
diff --git a/src/backend/gpopt/translate/CTranslatorQueryToDXL.cpp b/src/backend/gpopt/translate/CTranslatorQueryToDXL.cpp
index 0388d87a56a9..3f6028687668 100644
--- a/src/backend/gpopt/translate/CTranslatorQueryToDXL.cpp
+++ b/src/backend/gpopt/translate/CTranslatorQueryToDXL.cpp
@@ -492,11 +492,6 @@ CTranslatorQueryToDXL::TranslateSelectQueryToDXL()
// We therefore need to check permissions before we go into optimization for all RTEs, including the ones not explicitly referred in the query, e.g. views.
CTranslatorUtils::CheckRTEPermissions(m_query->rtable);
- // RETURNING is not supported yet.
- if (m_query->returningList)
- GPOS_RAISE(gpdxl::ExmaDXL, gpdxl::ExmiQuery2DXLUnsupportedFeature,
- GPOS_WSZ_LIT("RETURNING clause"));
-
CDXLNode *child_dxlnode = NULL;
IntToUlongMap *sort_group_attno_to_colid_mapping =
GPOS_NEW(m_mp) IntToUlongMap(m_mp);
@@ -817,7 +812,12 @@ CTranslatorQueryToDXL::TranslateInsertQueryToDXL()
query_dxlnode = project_dxlnode;
}
- return GPOS_NEW(m_mp) CDXLNode(m_mp, insert_dxlnode, query_dxlnode);
+ CDXLNode *log_insert_dxlnode =
+ GPOS_NEW(m_mp) CDXLNode(m_mp, insert_dxlnode, query_dxlnode);
+
+ log_insert_dxlnode = ProcessReturningList(log_insert_dxlnode, table_descr);
+
+ return log_insert_dxlnode;
}
//---------------------------------------------------------------------------
@@ -834,6 +834,16 @@ CTranslatorQueryToDXL::TranslateCTASToDXL()
GPOS_ASSERT(CMD_SELECT == m_query->commandType);
//GPOS_ASSERT(NULL != m_query->intoClause);
+ if (m_query->hasModifyingCTE)
+ {
+ // GPDB cannot have two writer segworker groups for one query.
+ // Furtherly, during execution stage an error will be thrown.
+ // However, showing the error early during translating stage would be more effective
+ GPOS_RAISE(
+ gpdxl::ExmaDXL, gpdxl::ExmiQuery2DXLUnsupportedFeature,
+ GPOS_WSZ_LIT("cannot create plan with several writing gangs"));
+ }
+
m_is_ctas_query = true;
CDXLNode *query_dxlnode = TranslateSelectQueryToDXL();
@@ -1137,6 +1147,60 @@ CTranslatorQueryToDXL::GetSystemColId(INT attribute_number)
return res;
}
+//---------------------------------------------------------------------------
+// @function:
+// CTranslatorQueryToDXL::ProcessReturningList
+//
+// @doc: Wrap dxl node in logical project with return columns from returningList
+//
+//---------------------------------------------------------------------------
+CDXLNode *
+CTranslatorQueryToDXL::ProcessReturningList(CDXLNode *dml_dxlnode,
+ CDXLTableDescr *table_descr)
+{
+ GPOS_ASSERT(dml_dxlnode != NULL);
+
+ CRefCount::SafeRelease(m_dxl_query_output_cols);
+
+ if (m_query->returningList != NULL)
+ {
+ IntToUlongMap *sort_group_attno_to_colid_mapping =
+ GPOS_NEW(m_mp) IntToUlongMap(m_mp);
+ IntToUlongMap *output_attno_to_colid_mapping =
+ GPOS_NEW(m_mp) IntToUlongMap(m_mp);
+
+ // DML nodes output columns as in descriptor, temporary replace mapping
+ CMappingVarColId *var_to_colid_map_saved = m_var_to_colid_map;
+ m_var_to_colid_map = GPOS_NEW(m_mp) CMappingVarColId(m_mp);
+ m_var_to_colid_map->LoadTblColumns(
+ m_query_level, m_query->resultRelation, table_descr);
+
+ dml_dxlnode = TranslateTargetListToDXLProject(
+ m_query->returningList, dml_dxlnode,
+ sort_group_attno_to_colid_mapping, output_attno_to_colid_mapping,
+ m_query->groupClause);
+
+ // this array is filled earlier with target list and was used to get colids by their indices earlier
+ // now fill it with what will truly be returned
+ m_dxl_query_output_cols = CreateDXLOutputCols(
+ m_query->returningList, output_attno_to_colid_mapping);
+
+ GPOS_DELETE(m_var_to_colid_map);
+ m_var_to_colid_map = var_to_colid_map_saved;
+
+ output_attno_to_colid_mapping->Release();
+ sort_group_attno_to_colid_mapping->Release();
+ }
+ else
+ {
+ // we can safely set it to empty array here as we aren't outputting in this path
+ m_dxl_query_output_cols = GPOS_NEW(m_mp) CDXLNodeArray(m_mp);
+ }
+
+ // return project_dxlnode;
+ return dml_dxlnode;
+}
+
//---------------------------------------------------------------------------
// @function:
// CTranslatorQueryToDXL::TranslateDeleteQueryToDXL
@@ -1214,7 +1278,12 @@ CTranslatorQueryToDXL::TranslateDeleteQueryToDXL()
CDXLLogicalDelete(m_mp, table_descr, ctid_colid, segid_colid,
delete_colid_array, tableoid_colid);
- return GPOS_NEW(m_mp) CDXLNode(m_mp, delete_dxlop, query_dxlnode);
+ CDXLNode *log_delete_dxlnode =
+ GPOS_NEW(m_mp) CDXLNode(m_mp, delete_dxlop, query_dxlnode);
+
+ log_delete_dxlnode = ProcessReturningList(log_delete_dxlnode, table_descr);
+
+ return log_delete_dxlnode;
}
//---------------------------------------------------------------------------
@@ -1328,7 +1397,12 @@ CTranslatorQueryToDXL::TranslateUpdateQueryToDXL()
m_mp, table_descr, ctid_colid, segmentid_colid, delete_colid_array,
insert_colid_array, has_oids, tuple_oid_colid, tableoid_colid);
- return GPOS_NEW(m_mp) CDXLNode(m_mp, pdxlopupdate, query_dxlnode);
+ CDXLNode *log_update_dxlnode =
+ GPOS_NEW(m_mp) CDXLNode(m_mp, pdxlopupdate, query_dxlnode);
+
+ log_update_dxlnode = ProcessReturningList(log_update_dxlnode, table_descr);
+
+ return log_update_dxlnode;
}
//---------------------------------------------------------------------------
@@ -4606,7 +4680,7 @@ CTranslatorQueryToDXL::ConstructCTEProducerList(List *cte_list,
// translate query representing the cte table to its DXL representation
CDXLNode *cte_child_dxlnode =
- query_to_dxl_translator.TranslateSelectQueryToDXL();
+ query_to_dxl_translator.TranslateQueryToDXL();
// get the output columns of the cte table
CDXLNodeArray *cte_query_output_colds_dxlnode_array =
diff --git a/src/backend/gporca/data/dxl/minidump/AddRedistributeBeforeInsert-1.mdp b/src/backend/gporca/data/dxl/minidump/AddRedistributeBeforeInsert-1.mdp
index 49090951fc8e..1f65b9c99246 100644
--- a/src/backend/gporca/data/dxl/minidump/AddRedistributeBeforeInsert-1.mdp
+++ b/src/backend/gporca/data/dxl/minidump/AddRedistributeBeforeInsert-1.mdp
@@ -207,10 +207,7 @@
-
-
-
-
+
@@ -244,11 +241,12 @@
-
+
-
+
+
@@ -259,15 +257,13 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -281,8 +277,8 @@
-
-
+
+
@@ -298,7 +294,7 @@
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/AddRedistributeBeforeInsert-2.mdp b/src/backend/gporca/data/dxl/minidump/AddRedistributeBeforeInsert-2.mdp
index 4412465aadb9..843c2cd47fbd 100644
--- a/src/backend/gporca/data/dxl/minidump/AddRedistributeBeforeInsert-2.mdp
+++ b/src/backend/gporca/data/dxl/minidump/AddRedistributeBeforeInsert-2.mdp
@@ -198,10 +198,7 @@
-
-
-
-
+
@@ -251,11 +248,12 @@
-
+
-
+
+
@@ -266,15 +264,13 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -288,8 +284,8 @@
-
-
+
+
@@ -305,7 +301,7 @@
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/AddRedistributeBeforeInsert-3.mdp b/src/backend/gporca/data/dxl/minidump/AddRedistributeBeforeInsert-3.mdp
index f6b3a2994cfa..a086c796e473 100644
--- a/src/backend/gporca/data/dxl/minidump/AddRedistributeBeforeInsert-3.mdp
+++ b/src/backend/gporca/data/dxl/minidump/AddRedistributeBeforeInsert-3.mdp
@@ -228,10 +228,7 @@
-
-
-
-
+
@@ -281,11 +278,12 @@
-
+
-
+
+
@@ -296,15 +294,13 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -318,8 +314,8 @@
-
-
+
+
@@ -335,7 +331,7 @@
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/AddRedistributeBeforeInsert-4.mdp b/src/backend/gporca/data/dxl/minidump/AddRedistributeBeforeInsert-4.mdp
index 1edb39f961e8..17d6e96ba7ea 100644
--- a/src/backend/gporca/data/dxl/minidump/AddRedistributeBeforeInsert-4.mdp
+++ b/src/backend/gporca/data/dxl/minidump/AddRedistributeBeforeInsert-4.mdp
@@ -245,10 +245,7 @@
-
-
-
-
+
@@ -335,11 +332,12 @@
-
+
-
+
+
@@ -350,15 +348,13 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -372,8 +368,8 @@
-
-
+
+
@@ -389,7 +385,7 @@
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/AddRedistributeBeforeInsert-5.mdp b/src/backend/gporca/data/dxl/minidump/AddRedistributeBeforeInsert-5.mdp
index dbf0477c35ad..54b89404c80a 100644
--- a/src/backend/gporca/data/dxl/minidump/AddRedistributeBeforeInsert-5.mdp
+++ b/src/backend/gporca/data/dxl/minidump/AddRedistributeBeforeInsert-5.mdp
@@ -214,10 +214,7 @@
-
-
-
-
+
@@ -251,11 +248,12 @@
-
+
-
+
+
@@ -266,15 +264,13 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -288,8 +284,8 @@
-
-
+
+
@@ -305,7 +301,7 @@
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/CPhysicalParallelUnionAllTest/ParallelAppend-Insert.mdp b/src/backend/gporca/data/dxl/minidump/CPhysicalParallelUnionAllTest/ParallelAppend-Insert.mdp
index 68e9e4d3b960..05297ab7ec54 100644
--- a/src/backend/gporca/data/dxl/minidump/CPhysicalParallelUnionAllTest/ParallelAppend-Insert.mdp
+++ b/src/backend/gporca/data/dxl/minidump/CPhysicalParallelUnionAllTest/ParallelAppend-Insert.mdp
@@ -142,9 +142,7 @@ INSERT INTO t VALUES (11),(12),(13);
-
-
-
+
@@ -191,11 +189,12 @@ INSERT INTO t VALUES (11),(12),(13);
-
+
-
+
+
@@ -203,14 +202,14 @@ INSERT INTO t VALUES (11),(12),(13);
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -221,7 +220,7 @@ INSERT INTO t VALUES (11),(12),(13);
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/CTAS-Random.mdp b/src/backend/gporca/data/dxl/minidump/CTAS-Random.mdp
index 97c43a0ca69d..89311fe170bf 100644
--- a/src/backend/gporca/data/dxl/minidump/CTAS-Random.mdp
+++ b/src/backend/gporca/data/dxl/minidump/CTAS-Random.mdp
@@ -213,8 +213,8 @@
-
-
+
+
@@ -236,7 +236,7 @@
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/CTAS-With-Global-Local-Agg.mdp b/src/backend/gporca/data/dxl/minidump/CTAS-With-Global-Local-Agg.mdp
index d1447b6788f2..fd0a0fc4cc87 100644
--- a/src/backend/gporca/data/dxl/minidump/CTAS-With-Global-Local-Agg.mdp
+++ b/src/backend/gporca/data/dxl/minidump/CTAS-With-Global-Local-Agg.mdp
@@ -717,7 +717,7 @@
-
+
@@ -733,7 +733,7 @@
-
+
@@ -757,9 +757,9 @@
-
+
-
+
@@ -773,8 +773,8 @@
-
-
+
+
@@ -785,10 +785,10 @@
-
-
+
+
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/CTAS-random-distr.mdp b/src/backend/gporca/data/dxl/minidump/CTAS-random-distr.mdp
index 774f0fa5e24f..81505553e034 100644
--- a/src/backend/gporca/data/dxl/minidump/CTAS-random-distr.mdp
+++ b/src/backend/gporca/data/dxl/minidump/CTAS-random-distr.mdp
@@ -178,9 +178,9 @@
-
-
-
+
+
+
@@ -208,8 +208,8 @@
-
-
+
+
@@ -228,7 +228,7 @@
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/CTAS-random-distributed-from-replicated-distributed-table.mdp b/src/backend/gporca/data/dxl/minidump/CTAS-random-distributed-from-replicated-distributed-table.mdp
index bbaf037be151..cb5dd26fd068 100644
--- a/src/backend/gporca/data/dxl/minidump/CTAS-random-distributed-from-replicated-distributed-table.mdp
+++ b/src/backend/gporca/data/dxl/minidump/CTAS-random-distributed-from-replicated-distributed-table.mdp
@@ -243,8 +243,8 @@
-
-
+
+
@@ -266,8 +266,8 @@
-
-
+
+
@@ -283,7 +283,7 @@
-
+
@@ -316,7 +316,7 @@
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/CTAS-with-Limit.mdp b/src/backend/gporca/data/dxl/minidump/CTAS-with-Limit.mdp
index e1db851c6cdc..892b40a0e1b0 100644
--- a/src/backend/gporca/data/dxl/minidump/CTAS-with-Limit.mdp
+++ b/src/backend/gporca/data/dxl/minidump/CTAS-with-Limit.mdp
@@ -656,8 +656,8 @@
-
-
+
+
@@ -679,7 +679,7 @@
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/CTAS-with-hashed-distributed-external-table.mdp b/src/backend/gporca/data/dxl/minidump/CTAS-with-hashed-distributed-external-table.mdp
index 4163127856d3..5278b5afe947 100644
--- a/src/backend/gporca/data/dxl/minidump/CTAS-with-hashed-distributed-external-table.mdp
+++ b/src/backend/gporca/data/dxl/minidump/CTAS-with-hashed-distributed-external-table.mdp
@@ -247,9 +247,9 @@ EXPLAIN CREATE TABLE Test AS SELECT * FROM test_gpfdist_ext DISTRIBUTED BY (a);
-
-
-
+
+
+
@@ -277,7 +277,7 @@ EXPLAIN CREATE TABLE Test AS SELECT * FROM test_gpfdist_ext DISTRIBUTED BY (a);
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/CTAS-with-randomly-distributed-external-table.mdp b/src/backend/gporca/data/dxl/minidump/CTAS-with-randomly-distributed-external-table.mdp
index 50ea84fb45c8..6b856921ebcc 100644
--- a/src/backend/gporca/data/dxl/minidump/CTAS-with-randomly-distributed-external-table.mdp
+++ b/src/backend/gporca/data/dxl/minidump/CTAS-with-randomly-distributed-external-table.mdp
@@ -234,9 +234,9 @@ EXPLAIN CREATE TABLE Test AS SELECT * FROM test_ext DISTRIBUTED RANDOMLY;
-
-
-
+
+
+
@@ -264,8 +264,8 @@ EXPLAIN CREATE TABLE Test AS SELECT * FROM test_ext DISTRIBUTED RANDOMLY;
-
-
+
+
@@ -284,7 +284,7 @@ EXPLAIN CREATE TABLE Test AS SELECT * FROM test_ext DISTRIBUTED RANDOMLY;
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/CTAS.mdp b/src/backend/gporca/data/dxl/minidump/CTAS.mdp
index 2323355c74bb..00618b0ce76b 100644
--- a/src/backend/gporca/data/dxl/minidump/CTAS.mdp
+++ b/src/backend/gporca/data/dxl/minidump/CTAS.mdp
@@ -223,8 +223,8 @@
-
-
+
+
@@ -246,7 +246,7 @@
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/CTAS_OrderedAgg_multiple_cols.mdp b/src/backend/gporca/data/dxl/minidump/CTAS_OrderedAgg_multiple_cols.mdp
index 7d05fe0c4deb..be5008e1ae8b 100644
--- a/src/backend/gporca/data/dxl/minidump/CTAS_OrderedAgg_multiple_cols.mdp
+++ b/src/backend/gporca/data/dxl/minidump/CTAS_OrderedAgg_multiple_cols.mdp
@@ -1815,9 +1815,9 @@ EXPLAIN CREATE TABLE test AS
-
-
-
+
+
+
@@ -1845,7 +1845,7 @@ EXPLAIN CREATE TABLE test AS
-
+
@@ -1913,16 +1913,16 @@ EXPLAIN CREATE TABLE test AS
-
+
-
-
+
+
-
-
+
+
@@ -1930,16 +1930,16 @@ EXPLAIN CREATE TABLE test AS
-
+
-
-
+
+
-
+
-
+
@@ -1953,13 +1953,13 @@ EXPLAIN CREATE TABLE test AS
-
-
+
+
-
+
@@ -1968,23 +1968,23 @@ EXPLAIN CREATE TABLE test AS
-
-
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
@@ -2024,16 +2024,16 @@ EXPLAIN CREATE TABLE test AS
-
+
-
-
+
+
-
-
+
+
@@ -2041,16 +2041,16 @@ EXPLAIN CREATE TABLE test AS
-
+
-
-
+
+
-
+
-
+
@@ -2064,13 +2064,13 @@ EXPLAIN CREATE TABLE test AS
-
-
+
+
-
+
@@ -2079,15 +2079,15 @@ EXPLAIN CREATE TABLE test AS
-
-
+
+
-
+
@@ -2095,23 +2095,23 @@ EXPLAIN CREATE TABLE test AS
-
-
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
@@ -2152,16 +2152,16 @@ EXPLAIN CREATE TABLE test AS
-
+
-
-
+
+
-
-
+
+
@@ -2169,16 +2169,16 @@ EXPLAIN CREATE TABLE test AS
-
+
-
-
+
+
-
+
-
+
@@ -2192,13 +2192,13 @@ EXPLAIN CREATE TABLE test AS
-
-
+
+
-
+
@@ -2207,15 +2207,15 @@ EXPLAIN CREATE TABLE test AS
-
-
+
+
-
+
@@ -2223,23 +2223,23 @@ EXPLAIN CREATE TABLE test AS
-
-
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
@@ -2360,8 +2360,8 @@ EXPLAIN CREATE TABLE test AS
-
-
+
+
@@ -2375,8 +2375,8 @@ EXPLAIN CREATE TABLE test AS
-
-
+
+
@@ -2390,8 +2390,8 @@ EXPLAIN CREATE TABLE test AS
-
-
+
+
@@ -2408,11 +2408,11 @@ EXPLAIN CREATE TABLE test AS
-
-
+
+
-
-
+
+
@@ -2423,11 +2423,11 @@ EXPLAIN CREATE TABLE test AS
-
-
+
+
-
-
+
+
@@ -2442,18 +2442,18 @@ EXPLAIN CREATE TABLE test AS
-
-
+
+
-
-
+
+
-
+
@@ -2461,8 +2461,8 @@ EXPLAIN CREATE TABLE test AS
-
-
+
+
@@ -2471,8 +2471,8 @@ EXPLAIN CREATE TABLE test AS
-
-
+
+
@@ -2481,9 +2481,9 @@ EXPLAIN CREATE TABLE test AS
-
-
-
+
+
+
@@ -2494,8 +2494,8 @@ EXPLAIN CREATE TABLE test AS
-
-
+
+
@@ -2506,10 +2506,10 @@ EXPLAIN CREATE TABLE test AS
-
+
-
+
@@ -2523,8 +2523,8 @@ EXPLAIN CREATE TABLE test AS
-
-
+
+
@@ -2535,10 +2535,10 @@ EXPLAIN CREATE TABLE test AS
-
+
-
+
@@ -2547,16 +2547,16 @@ EXPLAIN CREATE TABLE test AS
-
+
-
-
+
+
-
-
+
+
@@ -2605,8 +2605,8 @@ EXPLAIN CREATE TABLE test AS
-
-
+
+
@@ -2620,8 +2620,8 @@ EXPLAIN CREATE TABLE test AS
-
-
+
+
@@ -2635,8 +2635,8 @@ EXPLAIN CREATE TABLE test AS
-
-
+
+
@@ -2653,11 +2653,11 @@ EXPLAIN CREATE TABLE test AS
-
-
+
+
-
-
+
+
@@ -2668,11 +2668,11 @@ EXPLAIN CREATE TABLE test AS
-
-
+
+
-
-
+
+
@@ -2687,18 +2687,18 @@ EXPLAIN CREATE TABLE test AS
-
-
+
+
-
-
+
+
-
+
@@ -2706,8 +2706,8 @@ EXPLAIN CREATE TABLE test AS
-
-
+
+
@@ -2716,8 +2716,8 @@ EXPLAIN CREATE TABLE test AS
-
-
+
+
@@ -2726,8 +2726,8 @@ EXPLAIN CREATE TABLE test AS
-
-
+
+
@@ -2737,9 +2737,9 @@ EXPLAIN CREATE TABLE test AS
-
-
-
+
+
+
@@ -2751,10 +2751,10 @@ EXPLAIN CREATE TABLE test AS
-
+
-
+
@@ -2768,8 +2768,8 @@ EXPLAIN CREATE TABLE test AS
-
-
+
+
@@ -2780,10 +2780,10 @@ EXPLAIN CREATE TABLE test AS
-
+
-
+
@@ -2792,16 +2792,16 @@ EXPLAIN CREATE TABLE test AS
-
+
-
-
+
+
-
-
+
+
@@ -2852,8 +2852,8 @@ EXPLAIN CREATE TABLE test AS
-
-
+
+
@@ -2867,8 +2867,8 @@ EXPLAIN CREATE TABLE test AS
-
-
+
+
@@ -2882,8 +2882,8 @@ EXPLAIN CREATE TABLE test AS
-
-
+
+
@@ -2900,11 +2900,11 @@ EXPLAIN CREATE TABLE test AS
-
-
+
+
-
-
+
+
@@ -2915,11 +2915,11 @@ EXPLAIN CREATE TABLE test AS
-
-
+
+
-
-
+
+
@@ -2934,18 +2934,18 @@ EXPLAIN CREATE TABLE test AS
-
-
+
+
-
-
+
+
-
+
@@ -2953,8 +2953,8 @@ EXPLAIN CREATE TABLE test AS
-
-
+
+
@@ -2963,8 +2963,8 @@ EXPLAIN CREATE TABLE test AS
-
-
+
+
@@ -2973,8 +2973,8 @@ EXPLAIN CREATE TABLE test AS
-
-
+
+
@@ -2984,9 +2984,9 @@ EXPLAIN CREATE TABLE test AS
-
-
-
+
+
+
@@ -2998,10 +2998,10 @@ EXPLAIN CREATE TABLE test AS
-
+
-
+
@@ -3015,8 +3015,8 @@ EXPLAIN CREATE TABLE test AS
-
-
+
+
@@ -3027,10 +3027,10 @@ EXPLAIN CREATE TABLE test AS
-
+
-
+
@@ -3039,16 +3039,16 @@ EXPLAIN CREATE TABLE test AS
-
+
-
-
+
+
-
-
+
+
diff --git a/src/backend/gporca/data/dxl/minidump/CTE-Preds2.mdp b/src/backend/gporca/data/dxl/minidump/CTE-Preds2.mdp
index 4ca0b999e5d2..5fd7b4e18c73 100644
--- a/src/backend/gporca/data/dxl/minidump/CTE-Preds2.mdp
+++ b/src/backend/gporca/data/dxl/minidump/CTE-Preds2.mdp
@@ -537,7 +537,6 @@
-
diff --git a/src/backend/gporca/data/dxl/minidump/CTE15HAReplicated.mdp b/src/backend/gporca/data/dxl/minidump/CTE15HAReplicated.mdp
index 045b35906fc4..c3854d359d48 100644
--- a/src/backend/gporca/data/dxl/minidump/CTE15HAReplicated.mdp
+++ b/src/backend/gporca/data/dxl/minidump/CTE15HAReplicated.mdp
@@ -660,7 +660,6 @@
-
diff --git a/src/backend/gporca/data/dxl/minidump/CTE15Replicated.mdp b/src/backend/gporca/data/dxl/minidump/CTE15Replicated.mdp
index de05b6cc2743..2bff029224f9 100644
--- a/src/backend/gporca/data/dxl/minidump/CTE15Replicated.mdp
+++ b/src/backend/gporca/data/dxl/minidump/CTE15Replicated.mdp
@@ -689,7 +689,6 @@
-
diff --git a/src/backend/gporca/data/dxl/minidump/CannotPullGrpColAboveAgg.mdp b/src/backend/gporca/data/dxl/minidump/CannotPullGrpColAboveAgg.mdp
index 244cd8480c86..cdc56a8ecdbe 100644
--- a/src/backend/gporca/data/dxl/minidump/CannotPullGrpColAboveAgg.mdp
+++ b/src/backend/gporca/data/dxl/minidump/CannotPullGrpColAboveAgg.mdp
@@ -4452,28 +4452,6 @@ The SQL along with the DDL are in TINC repo. In the aggregates directory under q
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -4571,27 +4549,6 @@ The SQL along with the DDL are in TINC repo. In the aggregates directory under q
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/backend/gporca/data/dxl/minidump/ConvertHashToRandomInsert.mdp b/src/backend/gporca/data/dxl/minidump/ConvertHashToRandomInsert.mdp
index 6b3fa10d1d77..77262d6ea606 100644
--- a/src/backend/gporca/data/dxl/minidump/ConvertHashToRandomInsert.mdp
+++ b/src/backend/gporca/data/dxl/minidump/ConvertHashToRandomInsert.mdp
@@ -597,10 +597,7 @@ explain analyze insert into t1 select t2.a,t3.b from t2, t3 where t2.a = t3.a;
-
-
-
-
+
@@ -643,11 +640,12 @@ explain analyze insert into t1 select t2.a,t3.b from t2, t3 where t2.a = t3.a;
-
+
-
+
+
@@ -658,11 +656,10 @@ explain analyze insert into t1 select t2.a,t3.b from t2, t3 where t2.a = t3.a;
-
-
-
-
-
+
+
+
+
@@ -676,7 +673,7 @@ explain analyze insert into t1 select t2.a,t3.b from t2, t3 where t2.a = t3.a;
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/DML-ComputeScalar-With-Outerref.mdp b/src/backend/gporca/data/dxl/minidump/DML-ComputeScalar-With-Outerref.mdp
index 7fa3c0255346..007fd1db1896 100644
--- a/src/backend/gporca/data/dxl/minidump/DML-ComputeScalar-With-Outerref.mdp
+++ b/src/backend/gporca/data/dxl/minidump/DML-ComputeScalar-With-Outerref.mdp
@@ -236,9 +236,7 @@
-
-
-
+
@@ -319,11 +317,12 @@
-
+
-
+
+
@@ -331,14 +330,14 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -349,7 +348,7 @@
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/DML-Filter-With-OuterRef.mdp b/src/backend/gporca/data/dxl/minidump/DML-Filter-With-OuterRef.mdp
index 7d25616af5ce..58dce1e53a92 100644
--- a/src/backend/gporca/data/dxl/minidump/DML-Filter-With-OuterRef.mdp
+++ b/src/backend/gporca/data/dxl/minidump/DML-Filter-With-OuterRef.mdp
@@ -261,9 +261,7 @@
-
-
-
+
@@ -340,11 +338,12 @@
-
+
-
+
+
@@ -352,14 +351,14 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -370,7 +369,7 @@
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/DML-Replicated-Input.mdp b/src/backend/gporca/data/dxl/minidump/DML-Replicated-Input.mdp
index 9deff61aa45e..1b74d0f25f54 100644
--- a/src/backend/gporca/data/dxl/minidump/DML-Replicated-Input.mdp
+++ b/src/backend/gporca/data/dxl/minidump/DML-Replicated-Input.mdp
@@ -269,11 +269,7 @@ WHERE sach_vsnr = 465132477;
-
-
-
-
-
+
@@ -339,15 +335,16 @@ WHERE sach_vsnr = 465132477;
-
+
-
+
+
@@ -361,16 +358,14 @@ WHERE sach_vsnr = 465132477;
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -387,8 +382,8 @@ WHERE sach_vsnr = 465132477;
-
-
+
+
@@ -410,11 +405,11 @@ WHERE sach_vsnr = 465132477;
-
+
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/DML-UnionAll-With-OuterRef.mdp b/src/backend/gporca/data/dxl/minidump/DML-UnionAll-With-OuterRef.mdp
index 75b6255961de..cf6730e1e209 100644
--- a/src/backend/gporca/data/dxl/minidump/DML-UnionAll-With-OuterRef.mdp
+++ b/src/backend/gporca/data/dxl/minidump/DML-UnionAll-With-OuterRef.mdp
@@ -291,9 +291,7 @@
-
-
-
+
@@ -387,11 +385,12 @@
-
+
-
+
+
@@ -399,14 +398,14 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -417,7 +416,7 @@
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/DML-UnionAll-With-Universal-Child.mdp b/src/backend/gporca/data/dxl/minidump/DML-UnionAll-With-Universal-Child.mdp
index 1575731dddc4..5cf7bf756773 100644
--- a/src/backend/gporca/data/dxl/minidump/DML-UnionAll-With-Universal-Child.mdp
+++ b/src/backend/gporca/data/dxl/minidump/DML-UnionAll-With-Universal-Child.mdp
@@ -209,9 +209,7 @@
-
-
-
+
@@ -270,11 +268,12 @@
-
+
-
+
+
@@ -282,14 +281,14 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -300,8 +299,8 @@
-
-
+
+
@@ -319,7 +318,7 @@
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/DML-Volatile-Function.mdp b/src/backend/gporca/data/dxl/minidump/DML-Volatile-Function.mdp
index 150968b16a45..0ca5cc05ff86 100644
--- a/src/backend/gporca/data/dxl/minidump/DML-Volatile-Function.mdp
+++ b/src/backend/gporca/data/dxl/minidump/DML-Volatile-Function.mdp
@@ -201,9 +201,7 @@
-
-
-
+
@@ -249,11 +247,12 @@
-
+
-
+
+
@@ -261,14 +260,14 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -279,8 +278,8 @@
-
-
+
+
@@ -298,7 +297,7 @@
-
+
@@ -330,7 +329,7 @@
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/DML-With-CorrelatedNLJ-With-Universal-Child.mdp b/src/backend/gporca/data/dxl/minidump/DML-With-CorrelatedNLJ-With-Universal-Child.mdp
index 2d217a035871..5ba8d79fd3ea 100644
--- a/src/backend/gporca/data/dxl/minidump/DML-With-CorrelatedNLJ-With-Universal-Child.mdp
+++ b/src/backend/gporca/data/dxl/minidump/DML-With-CorrelatedNLJ-With-Universal-Child.mdp
@@ -230,9 +230,7 @@
-
-
-
+
@@ -283,15 +281,16 @@
-
+
-
+
+
@@ -299,14 +298,14 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -317,8 +316,8 @@
-
-
+
+
@@ -336,7 +335,7 @@
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/DML-With-HJ-And-UniversalChild.mdp b/src/backend/gporca/data/dxl/minidump/DML-With-HJ-And-UniversalChild.mdp
index 3ba8bf406547..d7e47246ce50 100644
--- a/src/backend/gporca/data/dxl/minidump/DML-With-HJ-And-UniversalChild.mdp
+++ b/src/backend/gporca/data/dxl/minidump/DML-With-HJ-And-UniversalChild.mdp
@@ -712,22 +712,23 @@
-
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -741,7 +742,7 @@
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/DML-With-Join-With-Universal-Child.mdp b/src/backend/gporca/data/dxl/minidump/DML-With-Join-With-Universal-Child.mdp
index e50b711dcf67..91fa9c36533a 100644
--- a/src/backend/gporca/data/dxl/minidump/DML-With-Join-With-Universal-Child.mdp
+++ b/src/backend/gporca/data/dxl/minidump/DML-With-Join-With-Universal-Child.mdp
@@ -185,9 +185,7 @@
-
-
-
+
@@ -238,11 +236,12 @@
-
+
-
+
+
@@ -250,14 +249,14 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -268,8 +267,8 @@
-
-
+
+
@@ -287,7 +286,7 @@
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/DML-With-MasterOnlyTable-1.mdp b/src/backend/gporca/data/dxl/minidump/DML-With-MasterOnlyTable-1.mdp
index 72a1d843aa12..a9ea9b9892c1 100644
--- a/src/backend/gporca/data/dxl/minidump/DML-With-MasterOnlyTable-1.mdp
+++ b/src/backend/gporca/data/dxl/minidump/DML-With-MasterOnlyTable-1.mdp
@@ -367,22 +367,23 @@
-
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -396,7 +397,7 @@
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/DML-With-WindowFunc-OuterRef.mdp b/src/backend/gporca/data/dxl/minidump/DML-With-WindowFunc-OuterRef.mdp
index 9eb9b5249fd2..0867830e9e5c 100644
--- a/src/backend/gporca/data/dxl/minidump/DML-With-WindowFunc-OuterRef.mdp
+++ b/src/backend/gporca/data/dxl/minidump/DML-With-WindowFunc-OuterRef.mdp
@@ -367,7 +367,7 @@
-
+
@@ -383,7 +383,7 @@
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/DMLCollapseProject.mdp b/src/backend/gporca/data/dxl/minidump/DMLCollapseProject.mdp
index 3e6e8eedd88e..fa0a8c3a5ee6 100644
--- a/src/backend/gporca/data/dxl/minidump/DMLCollapseProject.mdp
+++ b/src/backend/gporca/data/dxl/minidump/DMLCollapseProject.mdp
@@ -292,12 +292,7 @@
-
-
-
-
-
-
+
@@ -364,11 +359,12 @@
-
+
-
+
+
@@ -385,17 +381,14 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -415,8 +408,8 @@
-
-
+
+
@@ -443,13 +436,13 @@
-
+
-
+
@@ -486,7 +479,7 @@
-
+
@@ -496,7 +489,7 @@
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/Delete-With-Limit-In-Subquery.mdp b/src/backend/gporca/data/dxl/minidump/Delete-With-Limit-In-Subquery.mdp
index 10d155f5c64a..5a69ae0e56f9 100644
--- a/src/backend/gporca/data/dxl/minidump/Delete-With-Limit-In-Subquery.mdp
+++ b/src/backend/gporca/data/dxl/minidump/Delete-With-Limit-In-Subquery.mdp
@@ -722,22 +722,23 @@
-
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -751,7 +752,7 @@
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/DeleteInCTE.mdp b/src/backend/gporca/data/dxl/minidump/DeleteInCTE.mdp
new file mode 100644
index 000000000000..e4f0ccde6e14
--- /dev/null
+++ b/src/backend/gporca/data/dxl/minidump/DeleteInCTE.mdp
@@ -0,0 +1,374 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/backend/gporca/data/dxl/minidump/DeleteMismatchedDistribution.mdp b/src/backend/gporca/data/dxl/minidump/DeleteMismatchedDistribution.mdp
index 7981139961e2..3a8cede85a9d 100644
--- a/src/backend/gporca/data/dxl/minidump/DeleteMismatchedDistribution.mdp
+++ b/src/backend/gporca/data/dxl/minidump/DeleteMismatchedDistribution.mdp
@@ -338,24 +338,23 @@
-
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -369,7 +368,7 @@
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/DeleteRandomDistr.mdp b/src/backend/gporca/data/dxl/minidump/DeleteRandomDistr.mdp
index 3e0c0bb5176e..8e7954e657aa 100644
--- a/src/backend/gporca/data/dxl/minidump/DeleteRandomDistr.mdp
+++ b/src/backend/gporca/data/dxl/minidump/DeleteRandomDistr.mdp
@@ -203,23 +203,22 @@
-
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -233,7 +232,7 @@
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/DeleteRandomlyDistributedTable.mdp b/src/backend/gporca/data/dxl/minidump/DeleteRandomlyDistributedTable.mdp
index 7b1cbff5f6ba..5cca4ce4d5af 100644
--- a/src/backend/gporca/data/dxl/minidump/DeleteRandomlyDistributedTable.mdp
+++ b/src/backend/gporca/data/dxl/minidump/DeleteRandomlyDistributedTable.mdp
@@ -196,22 +196,22 @@
-
+
-
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -225,7 +225,7 @@
-
+
@@ -244,7 +244,7 @@
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/DeleteRandomlyDistributedTableJoin.mdp b/src/backend/gporca/data/dxl/minidump/DeleteRandomlyDistributedTableJoin.mdp
index 6b11f1b80d69..ab26edfe3494 100644
--- a/src/backend/gporca/data/dxl/minidump/DeleteRandomlyDistributedTableJoin.mdp
+++ b/src/backend/gporca/data/dxl/minidump/DeleteRandomlyDistributedTableJoin.mdp
@@ -278,22 +278,22 @@
-
+
-
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -307,7 +307,7 @@
-
+
@@ -385,7 +385,7 @@
-
+
@@ -409,7 +409,7 @@
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/DeleteReturning.mdp b/src/backend/gporca/data/dxl/minidump/DeleteReturning.mdp
new file mode 100644
index 000000000000..b6191cdec8d1
--- /dev/null
+++ b/src/backend/gporca/data/dxl/minidump/DeleteReturning.mdp
@@ -0,0 +1,356 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/backend/gporca/data/dxl/minidump/DeleteReturningProjection.mdp b/src/backend/gporca/data/dxl/minidump/DeleteReturningProjection.mdp
new file mode 100644
index 000000000000..c400d72167e5
--- /dev/null
+++ b/src/backend/gporca/data/dxl/minidump/DeleteReturningProjection.mdp
@@ -0,0 +1,363 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/backend/gporca/data/dxl/minidump/DeleteWithAfterTriggerDroppedCol.mdp b/src/backend/gporca/data/dxl/minidump/DeleteWithAfterTriggerDroppedCol.mdp
index fc5736e6dd0a..6cb830e68c75 100644
--- a/src/backend/gporca/data/dxl/minidump/DeleteWithAfterTriggerDroppedCol.mdp
+++ b/src/backend/gporca/data/dxl/minidump/DeleteWithAfterTriggerDroppedCol.mdp
@@ -251,7 +251,7 @@ drop function func_trigger();
-
+
@@ -261,16 +261,21 @@ drop function func_trigger();
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -287,7 +292,7 @@ drop function func_trigger();
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/DeleteWithTriggers.mdp b/src/backend/gporca/data/dxl/minidump/DeleteWithTriggers.mdp
index 12c7c39db808..58488b4151ac 100644
--- a/src/backend/gporca/data/dxl/minidump/DeleteWithTriggers.mdp
+++ b/src/backend/gporca/data/dxl/minidump/DeleteWithTriggers.mdp
@@ -233,7 +233,7 @@
-
+
@@ -249,18 +249,27 @@
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -283,8 +292,8 @@
-
-
+
+
@@ -307,7 +316,7 @@
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/DontAddRedistributeBeforeInsert-1.mdp b/src/backend/gporca/data/dxl/minidump/DontAddRedistributeBeforeInsert-1.mdp
index 5720e5ef715e..ef558d4f4c7b 100644
--- a/src/backend/gporca/data/dxl/minidump/DontAddRedistributeBeforeInsert-1.mdp
+++ b/src/backend/gporca/data/dxl/minidump/DontAddRedistributeBeforeInsert-1.mdp
@@ -265,10 +265,7 @@ Physical plan:
-
-
-
-
+
@@ -355,11 +352,12 @@ Physical plan:
-
+
-
+
+
@@ -370,15 +368,13 @@ Physical plan:
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -392,7 +388,7 @@ Physical plan:
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/DontAddRedistributeBeforeInsert-2.mdp b/src/backend/gporca/data/dxl/minidump/DontAddRedistributeBeforeInsert-2.mdp
index 92b167af0a71..dead8bc5f687 100644
--- a/src/backend/gporca/data/dxl/minidump/DontAddRedistributeBeforeInsert-2.mdp
+++ b/src/backend/gporca/data/dxl/minidump/DontAddRedistributeBeforeInsert-2.mdp
@@ -168,9 +168,7 @@
-
-
-
+
@@ -221,11 +219,12 @@
-
+
-
+
+
@@ -233,14 +232,13 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -251,7 +249,7 @@
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/ExpandFullOuterJoin.mdp b/src/backend/gporca/data/dxl/minidump/ExpandFullOuterJoin.mdp
index 669c876297da..61555de1f6c1 100644
--- a/src/backend/gporca/data/dxl/minidump/ExpandFullOuterJoin.mdp
+++ b/src/backend/gporca/data/dxl/minidump/ExpandFullOuterJoin.mdp
@@ -332,7 +332,6 @@ select * from t full join s on t1 = s1;
-
@@ -428,7 +427,6 @@ select * from t full join s on t1 = s1;
-
diff --git a/src/backend/gporca/data/dxl/minidump/IndexApply-Heterogeneous-DTS.mdp b/src/backend/gporca/data/dxl/minidump/IndexApply-Heterogeneous-DTS.mdp
index 69929c639448..6723f7796710 100644
--- a/src/backend/gporca/data/dxl/minidump/IndexApply-Heterogeneous-DTS.mdp
+++ b/src/backend/gporca/data/dxl/minidump/IndexApply-Heterogeneous-DTS.mdp
@@ -628,8 +628,6 @@ WHERE tt.event_ts >= tq.ets AND
-
-
diff --git a/src/backend/gporca/data/dxl/minidump/IndexApply-Heterogeneous-NoDTS.mdp b/src/backend/gporca/data/dxl/minidump/IndexApply-Heterogeneous-NoDTS.mdp
index 7048d28b8497..56725a5297a8 100644
--- a/src/backend/gporca/data/dxl/minidump/IndexApply-Heterogeneous-NoDTS.mdp
+++ b/src/backend/gporca/data/dxl/minidump/IndexApply-Heterogeneous-NoDTS.mdp
@@ -721,8 +721,6 @@ ORDER BY 1 asc ;
-
-
diff --git a/src/backend/gporca/data/dxl/minidump/IndexApply-InnerSelect-Heterogeneous-DTS.mdp b/src/backend/gporca/data/dxl/minidump/IndexApply-InnerSelect-Heterogeneous-DTS.mdp
index 39a1300e9c27..e3e2627b6535 100644
--- a/src/backend/gporca/data/dxl/minidump/IndexApply-InnerSelect-Heterogeneous-DTS.mdp
+++ b/src/backend/gporca/data/dxl/minidump/IndexApply-InnerSelect-Heterogeneous-DTS.mdp
@@ -667,8 +667,6 @@ WHERE tt.event_ts >= tq.ets AND
-
-
diff --git a/src/backend/gporca/data/dxl/minidump/InnerJoinOverJoinExcept.mdp b/src/backend/gporca/data/dxl/minidump/InnerJoinOverJoinExcept.mdp
index 84b94940e4b7..dcc00ede0925 100644
--- a/src/backend/gporca/data/dxl/minidump/InnerJoinOverJoinExcept.mdp
+++ b/src/backend/gporca/data/dxl/minidump/InnerJoinOverJoinExcept.mdp
@@ -203,9 +203,7 @@ ON (a.col = b.col);
-
-
-
+
@@ -296,11 +294,12 @@ ON (a.col = b.col);
-
+
-
+
+
@@ -308,14 +307,14 @@ ON (a.col = b.col);
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -326,7 +325,7 @@ ON (a.col = b.col);
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/InnerJoinOverJoinExceptAll.mdp b/src/backend/gporca/data/dxl/minidump/InnerJoinOverJoinExceptAll.mdp
index 5eca98beb654..2a010f80027a 100644
--- a/src/backend/gporca/data/dxl/minidump/InnerJoinOverJoinExceptAll.mdp
+++ b/src/backend/gporca/data/dxl/minidump/InnerJoinOverJoinExceptAll.mdp
@@ -241,9 +241,7 @@ ON (a.col = b.col);
-
-
-
+
@@ -334,11 +332,12 @@ ON (a.col = b.col);
-
+
-
+
+
@@ -346,14 +345,14 @@ ON (a.col = b.col);
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -364,7 +363,7 @@ ON (a.col = b.col);
-
+
@@ -430,8 +429,8 @@ ON (a.col = b.col);
-
-
+
+
@@ -440,7 +439,7 @@ ON (a.col = b.col);
-
+
@@ -539,7 +538,7 @@ ON (a.col = b.col);
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/Insert-Parquet-Partitioned-SortDisabled.mdp b/src/backend/gporca/data/dxl/minidump/Insert-Parquet-Partitioned-SortDisabled.mdp
index f68421f2a3a1..efa3b4db8047 100644
--- a/src/backend/gporca/data/dxl/minidump/Insert-Parquet-Partitioned-SortDisabled.mdp
+++ b/src/backend/gporca/data/dxl/minidump/Insert-Parquet-Partitioned-SortDisabled.mdp
@@ -196,10 +196,7 @@
-
-
-
-
+
@@ -229,11 +226,12 @@
-
+
-
+
+
@@ -244,11 +242,10 @@
-
-
-
-
-
+
+
+
+
@@ -262,7 +259,7 @@
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/Insert-Parquet.mdp b/src/backend/gporca/data/dxl/minidump/Insert-Parquet.mdp
index 9007526f494c..f59e13d45ba8 100644
--- a/src/backend/gporca/data/dxl/minidump/Insert-Parquet.mdp
+++ b/src/backend/gporca/data/dxl/minidump/Insert-Parquet.mdp
@@ -177,10 +177,7 @@
-
-
-
-
+
@@ -210,11 +207,12 @@
-
+
-
+
+
@@ -225,11 +223,10 @@
-
-
-
-
-
+
+
+
+
@@ -243,7 +240,7 @@
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/Insert-With-HJ-CTE-Agg.mdp b/src/backend/gporca/data/dxl/minidump/Insert-With-HJ-CTE-Agg.mdp
index 42b2a550c565..a2388fe5232b 100644
--- a/src/backend/gporca/data/dxl/minidump/Insert-With-HJ-CTE-Agg.mdp
+++ b/src/backend/gporca/data/dxl/minidump/Insert-With-HJ-CTE-Agg.mdp
@@ -382,13 +382,7 @@
-
-
-
-
-
-
-
+
@@ -509,11 +503,12 @@
-
+
-
+
+
@@ -533,18 +528,14 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -559,7 +550,7 @@
-
+
@@ -573,7 +564,7 @@
-
+
@@ -663,7 +654,7 @@
-
+
@@ -756,7 +747,6 @@
-
diff --git a/src/backend/gporca/data/dxl/minidump/Insert.mdp b/src/backend/gporca/data/dxl/minidump/Insert.mdp
index 8fb25b77b944..f99e9ca05059 100644
--- a/src/backend/gporca/data/dxl/minidump/Insert.mdp
+++ b/src/backend/gporca/data/dxl/minidump/Insert.mdp
@@ -179,11 +179,12 @@
-
+
+
@@ -194,15 +195,14 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -216,7 +216,7 @@
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/InsertAssertSort.mdp b/src/backend/gporca/data/dxl/minidump/InsertAssertSort.mdp
index e93774f5ed43..c6d10bf5e445 100644
--- a/src/backend/gporca/data/dxl/minidump/InsertAssertSort.mdp
+++ b/src/backend/gporca/data/dxl/minidump/InsertAssertSort.mdp
@@ -303,11 +303,7 @@ explain insert into tbl_cds_buysell_orders_new (a,b,c)
-
-
-
-
-
+
@@ -366,11 +362,12 @@ explain insert into tbl_cds_buysell_orders_new (a,b,c)
-
+
-
+
+
@@ -396,16 +393,12 @@ explain insert into tbl_cds_buysell_orders_new (a,b,c)
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
@@ -434,8 +427,8 @@ explain insert into tbl_cds_buysell_orders_new (a,b,c)
-
-
+
+
@@ -477,8 +470,8 @@ explain insert into tbl_cds_buysell_orders_new (a,b,c)
-
-
+
+
@@ -497,20 +490,20 @@ explain insert into tbl_cds_buysell_orders_new (a,b,c)
-
+
-
+
-
+
-
+
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/InsertCheckConstraint.mdp b/src/backend/gporca/data/dxl/minidump/InsertCheckConstraint.mdp
index 981881230aec..ec9ece7aae38 100644
--- a/src/backend/gporca/data/dxl/minidump/InsertCheckConstraint.mdp
+++ b/src/backend/gporca/data/dxl/minidump/InsertCheckConstraint.mdp
@@ -280,7 +280,7 @@
-
+
@@ -289,6 +289,7 @@
+
@@ -305,17 +306,14 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -335,8 +333,8 @@
-
-
+
+
@@ -363,8 +361,8 @@
-
-
+
+
@@ -404,8 +402,8 @@
-
-
+
+
@@ -422,7 +420,7 @@
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/InsertConstTuple.mdp b/src/backend/gporca/data/dxl/minidump/InsertConstTuple.mdp
index a3482d548076..ee66d005c3bf 100644
--- a/src/backend/gporca/data/dxl/minidump/InsertConstTuple.mdp
+++ b/src/backend/gporca/data/dxl/minidump/InsertConstTuple.mdp
@@ -193,7 +193,7 @@
-
+
@@ -202,6 +202,7 @@
+
@@ -212,15 +213,14 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -234,7 +234,7 @@
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/InsertConstTupleRandomDistribution.mdp b/src/backend/gporca/data/dxl/minidump/InsertConstTupleRandomDistribution.mdp
index 1832797fd3d9..6261027d8fb6 100644
--- a/src/backend/gporca/data/dxl/minidump/InsertConstTupleRandomDistribution.mdp
+++ b/src/backend/gporca/data/dxl/minidump/InsertConstTupleRandomDistribution.mdp
@@ -169,10 +169,7 @@
-
-
-
-
+
@@ -209,11 +206,12 @@
-
+
-
+
+
@@ -224,15 +222,13 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -246,8 +242,8 @@
-
-
+
+
@@ -263,7 +259,7 @@
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/InsertConstTupleVolatileFunction.mdp b/src/backend/gporca/data/dxl/minidump/InsertConstTupleVolatileFunction.mdp
index 63d137b0f72a..5941e87d359b 100644
--- a/src/backend/gporca/data/dxl/minidump/InsertConstTupleVolatileFunction.mdp
+++ b/src/backend/gporca/data/dxl/minidump/InsertConstTupleVolatileFunction.mdp
@@ -187,10 +187,7 @@
-
-
-
-
+
@@ -231,11 +228,12 @@
-
+
-
+
+
@@ -246,15 +244,14 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -268,8 +265,8 @@
-
-
+
+
@@ -290,8 +287,8 @@
-
-
+
+
@@ -308,12 +305,12 @@
-
+
-
-
+
+
diff --git a/src/backend/gporca/data/dxl/minidump/InsertConstTupleVolatileFunctionMOTable.mdp b/src/backend/gporca/data/dxl/minidump/InsertConstTupleVolatileFunctionMOTable.mdp
index 0e8b62f5c330..859a37cad689 100644
--- a/src/backend/gporca/data/dxl/minidump/InsertConstTupleVolatileFunctionMOTable.mdp
+++ b/src/backend/gporca/data/dxl/minidump/InsertConstTupleVolatileFunctionMOTable.mdp
@@ -177,10 +177,7 @@
-
-
-
-
+
@@ -221,11 +218,12 @@
-
+
-
+
+
@@ -236,15 +234,13 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -258,8 +254,8 @@
-
-
+
+
@@ -276,15 +272,15 @@
-
+
-
-
+
+
diff --git a/src/backend/gporca/data/dxl/minidump/InsertDirectedDispatchNullValue.mdp b/src/backend/gporca/data/dxl/minidump/InsertDirectedDispatchNullValue.mdp
index 10d1979d9519..83603077172a 100644
--- a/src/backend/gporca/data/dxl/minidump/InsertDirectedDispatchNullValue.mdp
+++ b/src/backend/gporca/data/dxl/minidump/InsertDirectedDispatchNullValue.mdp
@@ -163,10 +163,7 @@
-
-
-
-
+
@@ -211,15 +208,16 @@
-
+
-
+
+
@@ -233,16 +231,14 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -259,8 +255,8 @@
-
-
+
+
@@ -284,8 +280,8 @@
-
-
+
+
@@ -302,7 +298,7 @@
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/InsertInCTE.mdp b/src/backend/gporca/data/dxl/minidump/InsertInCTE.mdp
new file mode 100644
index 000000000000..ad2b193dbb99
--- /dev/null
+++ b/src/backend/gporca/data/dxl/minidump/InsertInCTE.mdp
@@ -0,0 +1,581 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/backend/gporca/data/dxl/minidump/InsertIntoNonNullAfterDroppingColumn.mdp b/src/backend/gporca/data/dxl/minidump/InsertIntoNonNullAfterDroppingColumn.mdp
index 44b2c3d09545..5d0d4b08f392 100644
--- a/src/backend/gporca/data/dxl/minidump/InsertIntoNonNullAfterDroppingColumn.mdp
+++ b/src/backend/gporca/data/dxl/minidump/InsertIntoNonNullAfterDroppingColumn.mdp
@@ -148,9 +148,7 @@ EXPLAIN INSERT INTO ColumnMapping VALUES (NULL);
-
-
-
+
@@ -182,16 +180,17 @@ EXPLAIN INSERT INTO ColumnMapping VALUES (NULL);
-
-
+
+
-
+
-
+
+
@@ -199,14 +198,14 @@ EXPLAIN INSERT INTO ColumnMapping VALUES (NULL);
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -217,8 +216,8 @@ EXPLAIN INSERT INTO ColumnMapping VALUES (NULL);
-
-
+
+
@@ -236,8 +235,8 @@ EXPLAIN INSERT INTO ColumnMapping VALUES (NULL);
-
-
+
+
@@ -254,11 +253,11 @@ EXPLAIN INSERT INTO ColumnMapping VALUES (NULL);
-
+
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/InsertIntoReturning.mdp b/src/backend/gporca/data/dxl/minidump/InsertIntoReturning.mdp
new file mode 100644
index 000000000000..76f59a69ccf4
--- /dev/null
+++ b/src/backend/gporca/data/dxl/minidump/InsertIntoReturning.mdp
@@ -0,0 +1,299 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/backend/gporca/data/dxl/minidump/InsertIntoReturningProjection.mdp b/src/backend/gporca/data/dxl/minidump/InsertIntoReturningProjection.mdp
new file mode 100644
index 000000000000..92b077e42f44
--- /dev/null
+++ b/src/backend/gporca/data/dxl/minidump/InsertIntoReturningProjection.mdp
@@ -0,0 +1,342 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/backend/gporca/data/dxl/minidump/InsertMasterOnlyTable.mdp b/src/backend/gporca/data/dxl/minidump/InsertMasterOnlyTable.mdp
index 3f095c78d4dd..27eb4d2e9179 100644
--- a/src/backend/gporca/data/dxl/minidump/InsertMasterOnlyTable.mdp
+++ b/src/backend/gporca/data/dxl/minidump/InsertMasterOnlyTable.mdp
@@ -197,10 +197,7 @@
-
-
-
-
+
@@ -234,11 +231,12 @@
-
+
-
+
+
@@ -249,15 +247,13 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -271,7 +267,7 @@
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/InsertMasterOnlyTableConstTuple.mdp b/src/backend/gporca/data/dxl/minidump/InsertMasterOnlyTableConstTuple.mdp
index 116f585d839c..f29e0d1c90d9 100644
--- a/src/backend/gporca/data/dxl/minidump/InsertMasterOnlyTableConstTuple.mdp
+++ b/src/backend/gporca/data/dxl/minidump/InsertMasterOnlyTableConstTuple.mdp
@@ -135,10 +135,7 @@
-
-
-
-
+
@@ -175,11 +172,12 @@
-
+
-
+
+
@@ -190,15 +188,13 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -212,7 +208,7 @@
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/InsertMismatchedDistrubution-2.mdp b/src/backend/gporca/data/dxl/minidump/InsertMismatchedDistrubution-2.mdp
index 26b336933f48..28680674e7d5 100644
--- a/src/backend/gporca/data/dxl/minidump/InsertMismatchedDistrubution-2.mdp
+++ b/src/backend/gporca/data/dxl/minidump/InsertMismatchedDistrubution-2.mdp
@@ -225,11 +225,7 @@ explain insert into pt2 select * from r;
-
-
-
-
-
+
@@ -265,11 +261,12 @@ explain insert into pt2 select * from r;
-
+
-
+
+
@@ -283,16 +280,14 @@ explain insert into pt2 select * from r;
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -309,7 +304,7 @@ explain insert into pt2 select * from r;
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/InsertMismatchedDistrubution.mdp b/src/backend/gporca/data/dxl/minidump/InsertMismatchedDistrubution.mdp
index c5e4b7a1884e..358a2adff453 100644
--- a/src/backend/gporca/data/dxl/minidump/InsertMismatchedDistrubution.mdp
+++ b/src/backend/gporca/data/dxl/minidump/InsertMismatchedDistrubution.mdp
@@ -225,11 +225,7 @@ explain insert into pt2 select * from r;
-
-
-
-
-
+
@@ -265,11 +261,12 @@ explain insert into pt2 select * from r;
-
+
-
+
+
@@ -283,16 +280,14 @@ explain insert into pt2 select * from r;
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -309,7 +304,7 @@ explain insert into pt2 select * from r;
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/InsertNULLNotNULLConstraint.mdp b/src/backend/gporca/data/dxl/minidump/InsertNULLNotNULLConstraint.mdp
index 486cb39248be..4c9e0ee29ea4 100644
--- a/src/backend/gporca/data/dxl/minidump/InsertNULLNotNULLConstraint.mdp
+++ b/src/backend/gporca/data/dxl/minidump/InsertNULLNotNULLConstraint.mdp
@@ -132,9 +132,7 @@
-
-
-
+
@@ -167,15 +165,16 @@
-
+
-
+
+
@@ -183,14 +182,14 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -201,8 +200,8 @@
-
-
+
+
@@ -220,8 +219,8 @@
-
-
+
+
@@ -238,7 +237,7 @@
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/InsertNoEnforceConstraints.mdp b/src/backend/gporca/data/dxl/minidump/InsertNoEnforceConstraints.mdp
index 31b1fef69723..8448beb5926e 100644
--- a/src/backend/gporca/data/dxl/minidump/InsertNoEnforceConstraints.mdp
+++ b/src/backend/gporca/data/dxl/minidump/InsertNoEnforceConstraints.mdp
@@ -167,10 +167,7 @@ insert into constraints_tab values (NULL, -1);
-
-
-
-
+
@@ -207,11 +204,12 @@ insert into constraints_tab values (NULL, -1);
-
+
-
+
+
@@ -222,15 +220,14 @@ insert into constraints_tab values (NULL, -1);
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -244,7 +241,7 @@ insert into constraints_tab values (NULL, -1);
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/InsertNonSingleton.mdp b/src/backend/gporca/data/dxl/minidump/InsertNonSingleton.mdp
index 6317e6d9ce13..4e2f5d9f023e 100644
--- a/src/backend/gporca/data/dxl/minidump/InsertNonSingleton.mdp
+++ b/src/backend/gporca/data/dxl/minidump/InsertNonSingleton.mdp
@@ -241,9 +241,7 @@ EXPLAIN INSERT INTO snackbox SELECT a FROM (SELECT c FROM hottoast LIMIT 3) hott
-
-
-
+
@@ -302,11 +300,12 @@ EXPLAIN INSERT INTO snackbox SELECT a FROM (SELECT c FROM hottoast LIMIT 3) hott
-
+
-
+
+
@@ -314,14 +313,13 @@ EXPLAIN INSERT INTO snackbox SELECT a FROM (SELECT c FROM hottoast LIMIT 3) hott
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -332,7 +330,7 @@ EXPLAIN INSERT INTO snackbox SELECT a FROM (SELECT c FROM hottoast LIMIT 3) hott
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/InsertNotNullCols.mdp b/src/backend/gporca/data/dxl/minidump/InsertNotNullCols.mdp
index c06d5da9a90b..0cd3dd708282 100644
--- a/src/backend/gporca/data/dxl/minidump/InsertNotNullCols.mdp
+++ b/src/backend/gporca/data/dxl/minidump/InsertNotNullCols.mdp
@@ -213,11 +213,12 @@
-
+
+
@@ -228,15 +229,14 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -250,8 +250,8 @@
-
-
+
+
@@ -268,7 +268,7 @@
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/InsertPrimaryKeyFromMOTable.mdp b/src/backend/gporca/data/dxl/minidump/InsertPrimaryKeyFromMOTable.mdp
index b662c37bb44c..bf8d59806a88 100644
--- a/src/backend/gporca/data/dxl/minidump/InsertPrimaryKeyFromMOTable.mdp
+++ b/src/backend/gporca/data/dxl/minidump/InsertPrimaryKeyFromMOTable.mdp
@@ -199,10 +199,7 @@
-
-
-
-
+
@@ -236,11 +233,12 @@
-
+
-
+
+
@@ -251,15 +249,14 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -273,8 +270,8 @@
-
-
+
+
@@ -295,8 +292,8 @@
-
-
+
+
@@ -313,7 +310,7 @@
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/InsertProjectSort.mdp b/src/backend/gporca/data/dxl/minidump/InsertProjectSort.mdp
index 126aa598aec9..8db83ecbd83b 100644
--- a/src/backend/gporca/data/dxl/minidump/InsertProjectSort.mdp
+++ b/src/backend/gporca/data/dxl/minidump/InsertProjectSort.mdp
@@ -231,11 +231,7 @@ explain insert into tbl_cds_buysell_orders_new (a,b,c)
-
-
-
-
-
+
@@ -294,11 +290,12 @@ explain insert into tbl_cds_buysell_orders_new (a,b,c)
-
+
-
+
+
@@ -324,16 +321,12 @@ explain insert into tbl_cds_buysell_orders_new (a,b,c)
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
@@ -351,18 +344,18 @@ explain insert into tbl_cds_buysell_orders_new (a,b,c)
-
+
-
+
-
+
-
+
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/InsertRandomDistr.mdp b/src/backend/gporca/data/dxl/minidump/InsertRandomDistr.mdp
index 77e8d43e42fd..91f1645a644c 100644
--- a/src/backend/gporca/data/dxl/minidump/InsertRandomDistr.mdp
+++ b/src/backend/gporca/data/dxl/minidump/InsertRandomDistr.mdp
@@ -195,10 +195,7 @@
-
-
-
-
+
@@ -232,11 +229,12 @@
-
+
-
+
+
@@ -247,15 +245,13 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -269,7 +265,7 @@
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/InsertReplicatedIntoSerialHashDistributedTable.mdp b/src/backend/gporca/data/dxl/minidump/InsertReplicatedIntoSerialHashDistributedTable.mdp
index 6fc44f056968..81dd333ef59a 100644
--- a/src/backend/gporca/data/dxl/minidump/InsertReplicatedIntoSerialHashDistributedTable.mdp
+++ b/src/backend/gporca/data/dxl/minidump/InsertReplicatedIntoSerialHashDistributedTable.mdp
@@ -272,11 +272,7 @@ EXPLAIN (COSTS OFF) INSERT INTO distributed_table (val1, val2) SELECT val1, val2
-
-
-
-
-
+
@@ -320,11 +316,12 @@ EXPLAIN (COSTS OFF) INSERT INTO distributed_table (val1, val2) SELECT val1, val2
-
+
-
+
+
@@ -336,18 +333,16 @@ EXPLAIN (COSTS OFF) INSERT INTO distributed_table (val1, val2) SELECT val1, val2
-
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -364,7 +359,7 @@ EXPLAIN (COSTS OFF) INSERT INTO distributed_table (val1, val2) SELECT val1, val2
-
+
@@ -415,7 +410,7 @@ EXPLAIN (COSTS OFF) INSERT INTO distributed_table (val1, val2) SELECT val1, val2
-
+
@@ -441,7 +436,7 @@ EXPLAIN (COSTS OFF) INSERT INTO distributed_table (val1, val2) SELECT val1, val2
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/InsertSort.mdp b/src/backend/gporca/data/dxl/minidump/InsertSort.mdp
index 69208c10a1a5..e3e3cbf5432d 100644
--- a/src/backend/gporca/data/dxl/minidump/InsertSort.mdp
+++ b/src/backend/gporca/data/dxl/minidump/InsertSort.mdp
@@ -317,9 +317,7 @@ explain insert into nim1 select * from nim order by 1;
-
-
-
+
@@ -358,11 +356,12 @@ explain insert into nim1 select * from nim order by 1;
-
+
-
+
+
@@ -370,14 +369,14 @@ explain insert into nim1 select * from nim order by 1;
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -388,7 +387,7 @@ explain insert into nim1 select * from nim order by 1;
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/InsertSortDistributed2MasterOnly.mdp b/src/backend/gporca/data/dxl/minidump/InsertSortDistributed2MasterOnly.mdp
index 69ed58315668..b8bba0e041cf 100644
--- a/src/backend/gporca/data/dxl/minidump/InsertSortDistributed2MasterOnly.mdp
+++ b/src/backend/gporca/data/dxl/minidump/InsertSortDistributed2MasterOnly.mdp
@@ -238,11 +238,7 @@ explain insert into masteronly select * from distributedtable order by 1;
-
-
-
-
-
+
@@ -285,11 +281,12 @@ explain insert into masteronly select * from distributedtable order by 1;
-
+
-
+
+
@@ -303,16 +300,13 @@ explain insert into masteronly select * from distributedtable order by 1;
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -329,8 +323,8 @@ explain insert into masteronly select * from distributedtable order by 1;
-
-
+
+
@@ -349,7 +343,7 @@ explain insert into masteronly select * from distributedtable order by 1;
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/InsertWithDroppedCol.mdp b/src/backend/gporca/data/dxl/minidump/InsertWithDroppedCol.mdp
index 0c7287f305cc..a158d691dbd0 100644
--- a/src/backend/gporca/data/dxl/minidump/InsertWithDroppedCol.mdp
+++ b/src/backend/gporca/data/dxl/minidump/InsertWithDroppedCol.mdp
@@ -201,10 +201,7 @@
-
-
-
-
+
@@ -241,15 +238,16 @@
-
+
-
+
+
@@ -260,15 +258,14 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -282,8 +279,8 @@
-
-
+
+
@@ -304,8 +301,8 @@
-
-
+
+
@@ -324,7 +321,7 @@
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/InsertWithTriggers.mdp b/src/backend/gporca/data/dxl/minidump/InsertWithTriggers.mdp
index f4013ae61377..57387f2f2a09 100644
--- a/src/backend/gporca/data/dxl/minidump/InsertWithTriggers.mdp
+++ b/src/backend/gporca/data/dxl/minidump/InsertWithTriggers.mdp
@@ -266,7 +266,7 @@
-
+
@@ -286,18 +286,27 @@
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -314,8 +323,8 @@
-
-
+
+
@@ -332,7 +341,7 @@
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/LeftJoinNullsNotColocated.mdp b/src/backend/gporca/data/dxl/minidump/LeftJoinNullsNotColocated.mdp
index 5b8f2c06474e..1a1c4a2e1088 100644
--- a/src/backend/gporca/data/dxl/minidump/LeftJoinNullsNotColocated.mdp
+++ b/src/backend/gporca/data/dxl/minidump/LeftJoinNullsNotColocated.mdp
@@ -427,9 +427,9 @@ on id2 = id3 distributed by (id1);
-
-
-
+
+
+
@@ -457,7 +457,7 @@ on id2 = id3 distributed by (id1);
-
+
diff --git a/src/backend/gporca/data/dxl/minidump/LeftOuter2InnerUnionAllAntiSemiJoin-Tpcds.mdp b/src/backend/gporca/data/dxl/minidump/LeftOuter2InnerUnionAllAntiSemiJoin-Tpcds.mdp
index 9f7bf474084d..b1317acb6562 100644
--- a/src/backend/gporca/data/dxl/minidump/LeftOuter2InnerUnionAllAntiSemiJoin-Tpcds.mdp
+++ b/src/backend/gporca/data/dxl/minidump/LeftOuter2InnerUnionAllAntiSemiJoin-Tpcds.mdp
@@ -11731,29 +11731,8 @@ select * from v2 left outer join v1 on v2.i_item_sk = v1.ss_item_sk limit 5;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -11786,34 +11765,6 @@ select * from v2 left outer join v1 on v2.i_item_sk = v1.ss_item_sk limit 5;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -11841,27 +11792,6 @@ select * from v2 left outer join v1 on v2.i_item_sk = v1.ss_item_sk limit 5;