MCPcopy Create free account
hub / github.com/apache/cloudberry / create_modifytable_path

Function create_modifytable_path

src/backend/optimizer/util/pathnode.c:5830–5933  ·  view source on GitHub ↗

* create_modifytable_path * Creates a pathnode that represents performing INSERT/UPDATE/DELETE mods * * 'rel' is the parent relation associated with the result * 'subpath' is a Path producing source data * 'operation' is the operation type * 'canSetTag' is true if we set the command tag/es_processed * 'nominalRelation' is the parent RT index for use of EXPLAIN * 'rootRelation' is the par

Source from the content-addressed store, hash-verified

5828 * 'epqParam' is the ID of Param for EvalPlanQual re-eval
5829 */
5830ModifyTablePath *
5831create_modifytable_path(PlannerInfo *root, RelOptInfo *rel,
5832 Path *subpath,
5833 CmdType operation, bool canSetTag,
5834 Index nominalRelation, Index rootRelation,
5835 bool partColsUpdated,
5836 bool splitUpdate,
5837 List *resultRelations,
5838 List *updateColnosLists,
5839 List *withCheckOptionLists, List *returningLists,
5840 List *rowMarks, OnConflictExpr *onconflict,
5841 int epqParam)
5842{
5843 ModifyTablePath *pathnode = makeNode(ModifyTablePath);
5844
5845 Assert(operation == CMD_UPDATE ?
5846 list_length(resultRelations) == list_length(updateColnosLists) :
5847 updateColnosLists == NIL);
5848 Assert(withCheckOptionLists == NIL ||
5849 list_length(resultRelations) == list_length(withCheckOptionLists));
5850 Assert(returningLists == NIL ||
5851 list_length(resultRelations) == list_length(returningLists));
5852
5853 pathnode->path.pathtype = T_ModifyTable;
5854 pathnode->path.parent = rel;
5855 /* pathtarget is not interesting, just make it minimally valid */
5856 pathnode->path.pathtarget = rel->reltarget;
5857 /* For now, assume we are above any joins, so no parameterization */
5858 pathnode->path.param_info = NULL;
5859 pathnode->path.parallel_aware = false;
5860 pathnode->path.parallel_safe = false;
5861 pathnode->path.parallel_workers = 0;
5862 pathnode->path.pathkeys = NIL;
5863
5864 /*
5865 * Put Motions on top of the subpath as needed, and set the locus of the
5866 * ModifyTable path itself.
5867 */
5868 if (Gp_role == GP_ROLE_DISPATCH)
5869 pathnode->path.locus =
5870 adjust_modifytable_subpath(root, operation,
5871 linitial_int(resultRelations),
5872 &subpath, /* IN-OUT argument */
5873 splitUpdate);
5874 else
5875 {
5876 /* don't allow split updates in utility mode. */
5877 if (Gp_role == GP_ROLE_UTILITY && operation == CMD_UPDATE && splitUpdate)
5878 {
5879 ereport(ERROR,
5880 (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
5881 errmsg("cannot update distribution key columns in utility mode")));
5882 }
5883
5884 CdbPathLocus_MakeEntry(&pathnode->path.locus);
5885 }
5886
5887 /*

Callers 1

grouping_plannerFunction · 0.85

Calls 4

list_lengthFunction · 0.85
errcodeFunction · 0.50
errmsgFunction · 0.50

Tested by

no test coverage detected