68#define CP_EXACT_TLIST 0x0001
69#define CP_SMALL_TLIST 0x0002
70#define CP_LABEL_TLIST 0x0004
71#define CP_IGNORE_TLIST 0x0008
177 double limit_tuples);
179 List *pathkeys,
double limit_tuples);
185 List *indexorderby,
List *indexorderbyorig,
186 List *indexorderbyops,
196 List *indexqualorig);
200 List *bitmapqualorig,
217 Index scanrelid,
int ctePlanId,
int cteParam);
219 Index scanrelid,
char *enrname);
221 Index scanrelid,
int wtParam);
233 JoinType jointype,
bool inner_unique);
237 List *hashoperators,
List *hashcollations,
240 JoinType jointype,
bool inner_unique);
254 JoinType jointype,
bool inner_unique,
255 bool skip_mark_restore);
260 int numCols,
int nPresortedCols,
275 List *pathkeys,
Relids relids,
int nPresortedCols);
281 Oid *collations,
List *param_exprs,
282 bool singlerow,
bool binary_mode,
286 double est_hit_ratio);
290 List *runCondition,
List *qual,
bool topWindow,
296 List *pathkeys,
int numCols,
299 int nworkers,
int rescan_param,
bool single_copy,
Plan *subplan);
310 CmdType operation,
bool canSetTag,
312 List *resultRelations,
313 List *updateColnosLists,
314 List *withCheckOptionLists,
List *returningLists,
316 List *mergeActionLists,
List *mergeJoinConditions,
372 if (
root->curOuterParams !=
NIL)
373 elog(
ERROR,
"failed to assign all NestLoopParams to plan nodes");
536 elog(
ERROR,
"unrecognized node type: %d",
792 elog(
ERROR,
"unrecognized node type: %d",
823 foreach(v, path->pathtarget->exprs)
834 if (path->param_info)
903 path->pathtarget->exprs ==
NIL)
921 foreach(
lc,
root->placeholder_list)
941 if (!indexinfo->canreturn[
i])
960 foreach(
lc, path->pathtarget->exprs)
964 if (path->pathtarget->sortgrouprefs[
i])
966 if (expr &&
IsA(expr,
Var))
968 int attno = ((
Var *) expr)->varattno;
996 if (!
root->hasPseudoConstantQuals)
1063 return &gplan->
plan;
1092 elog(
ERROR,
"unrecognized node type: %d",
1158 FdwRoutine *fdwroutine = path->parent->fdwroutine;
1194 plan->async_capable =
true;
1216 int nasyncplans = 0;
1261 plan->plan.targetlist = tlist;
1267 if (pathkeys !=
NIL)
1305 if (pathkeys !=
NIL)
1339 elog(
ERROR,
"Append child's targetlist doesn't match Append");
1361 sortColIdx, sortOperators,
1372 sortColIdx, sortOperators,
1390 subplans =
lappend(subplans, subplan);
1394 plan->part_prune_index = -1;
1424 plan->appendplans = subplans;
1425 plan->nasyncplans = nasyncplans;
1439 plan->plan.parallel_safe);
1473 plan->targetlist = tlist;
1491 &node->sortOperators,
1534 if (
memcmp(sortColIdx, node->sortColIdx,
1536 elog(
ERROR,
"MergeAppend child's targetlist doesn't match MergeAppend");
1558 sortColIdx, sortOperators,
1569 sortColIdx, sortOperators,
1579 subplans =
lappend(subplans, subplan);
1729 operators =
palloc(nkeys *
sizeof(
Oid));
1730 collations =
palloc(nkeys *
sizeof(
Oid));
1738 operators[
i] = opno;
1788 root->glob->parallelModeNeeded =
true;
1812 gm_plan->plan.targetlist = tlist;
1840 gm_plan->plan.lefttree = subplan;
1843 root->glob->parallelModeNeeded =
true;
1971 plan->parallel_safe = parallel_safe;
2211 foreach(
lc, groupClause)
2263 foreach(
lc,
root->processed_groupClause)
2274 foreach(
lc,
root->processed_groupClause)
2424 plan->disabled_nodes =
mminfo->path->disabled_nodes;
2425 plan->startup_cost =
mminfo->path->startup_cost;
2427 plan->plan_rows = 1;
2428 plan->plan_width =
mminfo->path->pathtarget->width;
2429 plan->parallel_aware =
false;
2430 plan->parallel_safe =
mminfo->path->parallel_safe;
2714 foreach(l,
parse->sortClause)
2914 if (rinfo->pseudoconstant)
2946 indexorderbys = (
List *)
2978 elog(
ERROR,
"missing operator %d(%u,%u) in opfamily %u",
2980 indexorderbyops =
lappend_oid(indexorderbyops, sortop);
2997 indextle->resjunk = !indexinfo->canreturn[
i];
3043 List *bitmapqualorig;
3056 &bitmapqualorig, &indexquals,
3094 if (rinfo->pseudoconstant)
3129 bitmapqualorig = (
List *)
3187 foreach(l,
apath->bitmapquals)
3197 subplans =
lappend(subplans, subplan);
3204 plan->startup_cost =
apath->path.startup_cost;
3205 plan->total_cost =
apath->path.total_cost;
3208 plan->plan_width = 0;
3209 plan->parallel_aware =
false;
3210 plan->parallel_safe =
apath->path.parallel_safe;
3234 foreach(l,
opath->bitmapquals)
3244 subplans =
lappend(subplans, subplan);
3268 plan->startup_cost =
opath->path.startup_cost;
3269 plan->total_cost =
opath->path.total_cost;
3272 plan->plan_width = 0;
3273 plan->parallel_aware =
false;
3274 plan->parallel_safe =
opath->path.parallel_safe;
3315 plan->startup_cost = 0.0;
3316 plan->total_cost =
ipath->indextotalcost;
3319 plan->plan_width = 0;
3320 plan->parallel_aware =
false;
3321 plan->parallel_safe =
ipath->path.parallel_safe;
3326 foreach(l,
ipath->indexclauses)
3331 Assert(!rinfo->pseudoconstant);
3335 if (rinfo->parent_ec)
3339 foreach(l,
ipath->indexinfo->indpred)
3413 if (rinfo->pseudoconstant)
3495 if (rinfo->pseudoconstant)
3514 tidrangequals = (
List *)
3650 tablefunc =
rte->tablefunc;
3693 values_lists =
rte->values_lists;
3707 values_lists = (
List *)
3747 levelsup =
rte->ctelevelsup;
3749 while (levelsup-- > 0)
3753 elog(
ERROR,
"bad levelsup for CTE \"%s\"",
rte->ctename);
3771 elog(
ERROR,
"could not find CTE \"%s\"",
rte->ctename);
3773 elog(
ERROR,
"could not find plan for CTE \"%s\"",
rte->ctename);
3776 elog(
ERROR,
"no plan was made for CTE \"%s\"",
rte->ctename);
3784 elog(
ERROR,
"could not find plan for CTE \"%s\"",
rte->ctename);
3916 levelsup =
rte->ctelevelsup;
3918 elog(
ERROR,
"bad levelsup for CTE \"%s\"",
rte->ctename);
3921 while (levelsup-- > 0)
3925 elog(
ERROR,
"bad levelsup for CTE \"%s\"",
rte->ctename);
3928 elog(
ERROR,
"could not find param ID for CTE \"%s\"",
rte->ctename);
4030 root->outer_join_rels);
4038 root->glob->dependsOnRole =
true;
4208 best_path->jpath.outerjoinpath->parent);
4220 outerrelids =
best_path->jpath.outerjoinpath->parent->relids;
4250 joinclauses = (
List *)
4277 foreach(
lc, nestParams)
4405 joinclauses = (
List *)
4417 best_path->jpath.outerjoinpath->parent->relids);
4545 if (rinfo->outer_is_left)
4577 elog(
ERROR,
"outer pathkeys do not match mergeclauses");
4582 elog(
ERROR,
"outer pathkeys do not match mergeclauses");
4626 elog(
ERROR,
"inner pathkeys do not match mergeclauses");
4645 elog(
ERROR,
"left and right pathkeys do not match in mergejoin");
4649 elog(
ERROR,
"left and right pathkeys do not match in mergejoin");
4706 bool skewInherit =
false;
4754 joinclauses = (
List *)
4765 best_path->jpath.outerjoinpath->parent->relids);
4792 skewTable =
rte->relid;
4794 skewInherit =
rte->inh;
4807 foreach(
lc, hashclauses)
4838 if (
best_path->jpath.path.parallel_aware)
4911 root->curOuterRels))
4976 int indexcol =
iclause->indexcol;
5087 elog(
ERROR,
"unsupported indexqual type: %d",
5124 if (
index->indexkeys[indexcol] != 0)
5128 ((
Var *) node)->varno ==
index->rel->relid &&
5129 ((
Var *) node)->varattno ==
index->indexkeys[indexcol])
5134 return (
Node *) result;
5137 elog(
ERROR,
"index key does not match expected index column");
5142 for (pos = 0; pos <
index->ncolumns; pos++)
5144 if (
index->indexkeys[pos] == 0)
5147 elog(
ERROR,
"too few entries in indexprs list");
5148 if (pos == indexcol)
5161 return (
Node *) result;
5164 elog(
ERROR,
"index key does not match expected index column");
5171 elog(
ERROR,
"index key does not match expected index column");
5207 temp->opresulttype = clause->opresulttype;
5208 temp->opretset = clause->opretset;
5209 temp->opcollid = clause->opcollid;
5210 temp->inputcollid = clause->inputcollid;
5268 Index security_level;
5286 foreach(
lc, clauses)
5292 items[
i].clause = clause;
5309 items[
i].security_level = 0;
5314 items[
i].security_level = 0;
5329 for (
j =
i;
j > 0;
j--)
5333 if (newitem.security_level >
olditem->security_level ||
5334 (newitem.security_level ==
olditem->security_level &&
5335 newitem.cost >=
olditem->cost))
5361 dest->plan_rows = src->
rows;
5362 dest->plan_width = src->pathtarget->width;
5380 dest->parallel_aware =
false;
5403 plan->plan.disabled_nodes,
5414 plan->plan.parallel_aware =
false;
5424 List *pathkeys,
double limit_tuples)
5432 plan->nPresortedCols,
5433 plan->sort.plan.disabled_nodes,
5445 plan->sort.plan.parallel_aware =
false;
5526 List *indexqualorig,
5528 List *indexorderbyorig,
5529 List *indexorderbyops,
5584 List *indexqualorig)
5605 List *bitmapqualorig,
5613 plan->lefttree = lefttree;
5644 List *tidrangequals)
5684 bool funcordinality)
5804 List *fdw_scan_tlist,
5805 List *fdw_recheck_quals,
5814 plan->lefttree = outer_plan;
5850 plan->targetlist = tlist;
5852 plan->lefttree = lefttree;
5873 foreach(
slitem, distinctList)
5937 plan->targetlist = tlist;
5939 plan->lefttree = lefttree;
5954 List *hashoperators,
5955 List *hashcollations,
5965 plan->targetlist = tlist;
5967 plan->lefttree = lefttree;
5992 plan->lefttree = lefttree;
6016 bool skip_mark_restore)
6021 plan->targetlist = tlist;
6023 plan->lefttree = lefttree;
6058 plan->lefttree = lefttree;
6061 node->sortColIdx = sortColIdx;
6062 node->sortOperators = sortOperators;
6063 node->collations = collations;
6088 plan->lefttree = lefttree;
6092 node->
sort.sortColIdx = sortColIdx;
6093 node->
sort.sortOperators = sortOperators;
6094 node->
sort.collations = collations;
6171 foreach(
i, pathkeys)
6189 elog(
ERROR,
"volatile EquivalenceClass has no sortref");
6255 elog(
ERROR,
"could not find pathkey item to sort");
6293 elog(
ERROR,
"missing operator %d(%u,%u) in opfamily %u",
6345 sortColIdx, sortOperators,
6360 Relids relids,
int nPresortedCols)
6381 sortColIdx, sortOperators,
6424 sortColIdx, sortOperators,
6468 elog(
ERROR,
"could not retrieve tle for sort-from-groupcols");
6478 sortColIdx, sortOperators,
6490 plan->lefttree = lefttree;
6546 matplan->parallel_aware =
false;
6554 List *param_exprs,
bool singlerow,
bool binary_mode,
6557 double est_hit_ratio)
6564 plan->lefttree = lefttree;
6568 node->hashOperators = hashoperators;
6569 node->collations = collations;
6587 Size transitionSpace,
Plan *lefttree)
6602 node->
chain = chain;
6605 plan->targetlist = tlist;
6606 plan->lefttree = lefttree;
6616 List *runCondition,
List *qual,
bool topWindow,
Plan *lefttree)
6644 plan->targetlist = tlist;
6645 plan->lefttree = lefttree;
6670 plan->targetlist = tlist;
6671 plan->lefttree = lefttree;
6697 plan->lefttree = lefttree;
6710 foreach(
lc, pathkeys)
6721 if (keyno >= numCols)
6732 elog(
ERROR,
"volatile EquivalenceClass has no sortref");
6745 foreach(
j,
plan->targetlist)
6760 elog(
ERROR,
"could not find pathkey item to sort");
6771 elog(
ERROR,
"missing operator %d(%u,%u) in opfamily %u",
6803 plan->lefttree = subplan;
6834 plan->targetlist = tlist;
6836 plan->lefttree = lefttree;
6848 foreach(
slitem, groupList)
6888 plan->lefttree = lefttree;
6911 plan->lefttree = lefttree;
6932 Node *resconstantqual,
6940 plan->targetlist = tlist;
6942 plan->lefttree = subplan;
6963 Node *resconstantqual,
6994 plan->lefttree = subplan;
7006 CmdType operation,
bool canSetTag,
7008 List *resultRelations,
7009 List *updateColnosLists,
7010 List *withCheckOptionLists,
List *returningLists,
7012 List *mergeActionLists,
List *mergeJoinConditions,
7028 updateColnosLists ==
NIL));
7098 foreach(
lc, resultRelations)
7113 root->simple_rel_array[rti] !=
NULL)
7117 fdwroutine = resultRel->fdwroutine;
7133 errmsg(
"access to non-system foreign table is restricted")));
7155 errmsg(
"cannot execute MERGE on relation \"%s\"",
7169 if (fdwroutine !=
NULL &&
7174 withCheckOptionLists ==
NIL &&
7186 root->parse->returningList);
7207 fdwroutine !=
NULL &&
Datum sort(PG_FUNCTION_ARGS)
#define InvalidAttrNumber
Bitmapset * bms_difference(const Bitmapset *a, const Bitmapset *b)
bool bms_is_subset(const Bitmapset *a, const Bitmapset *b)
void bms_free(Bitmapset *a)
bool bms_is_member(int x, const Bitmapset *a)
Bitmapset * bms_add_member(Bitmapset *a, int x)
Bitmapset * bms_union(const Bitmapset *a, const Bitmapset *b)
bool bms_nonempty_difference(const Bitmapset *a, const Bitmapset *b)
#define PG_USED_FOR_ASSERTS_ONLY
#define Assert(condition)
#define OidIsValid(objectId)
bool contain_mutable_functions(Node *clause)
bool is_parallel_safe(PlannerInfo *root, Node *node)
Bitmapset * pull_paramids(Expr *expr)
void CommuteOpExpr(OpExpr *clause)
void cost_material(Path *path, bool enabled, int input_disabled_nodes, Cost input_startup_cost, Cost input_total_cost, double tuples, int width)
void cost_sort(Path *path, PlannerInfo *root, List *pathkeys, int input_disabled_nodes, Cost input_cost, double tuples, int width, Cost comparison_cost, int sort_mem, double limit_tuples)
void cost_qual_eval_node(QualCost *cost, Node *qual, PlannerInfo *root)
void cost_incremental_sort(Path *path, PlannerInfo *root, List *pathkeys, int presorted_keys, int input_disabled_nodes, Cost input_startup_cost, Cost input_total_cost, double input_tuples, int width, Cost comparison_cost, int sort_mem, double limit_tuples)
double clamp_row_est(double nrows)
bool enable_partition_pruning
bool enable_incremental_sort
static Plan * create_join_plan(PlannerInfo *root, JoinPath *best_path)
static bool use_physical_tlist(PlannerInfo *root, Path *path, int flags)
static ModifyTable * make_modifytable(PlannerInfo *root, Plan *subplan, CmdType operation, bool canSetTag, Index nominalRelation, Index rootRelation, List *resultRelations, List *updateColnosLists, List *withCheckOptionLists, List *returningLists, List *rowMarks, OnConflictExpr *onconflict, List *mergeActionLists, List *mergeJoinConditions, int epqParam)
static SeqScan * create_seqscan_plan(PlannerInfo *root, Path *best_path, List *tlist, List *scan_clauses)
static WorkTableScan * make_worktablescan(List *qptlist, List *qpqual, Index scanrelid, int wtParam)
static Plan * create_merge_append_plan(PlannerInfo *root, MergeAppendPath *best_path, int flags)
static List * order_qual_clauses(PlannerInfo *root, List *clauses)
static MergeJoin * make_mergejoin(List *tlist, List *joinclauses, List *otherclauses, List *mergeclauses, Oid *mergefamilies, Oid *mergecollations, bool *mergereversals, bool *mergenullsfirst, Plan *lefttree, Plan *righttree, JoinType jointype, bool inner_unique, bool skip_mark_restore)
static GatherMerge * create_gather_merge_plan(PlannerInfo *root, GatherMergePath *best_path)
static ValuesScan * create_valuesscan_plan(PlannerInfo *root, Path *best_path, List *tlist, List *scan_clauses)
static void copy_generic_path_info(Plan *dest, Path *src)
static WindowAgg * make_windowagg(List *tlist, WindowClause *wc, int partNumCols, AttrNumber *partColIdx, Oid *partOperators, Oid *partCollations, int ordNumCols, AttrNumber *ordColIdx, Oid *ordOperators, Oid *ordCollations, List *runCondition, List *qual, bool topWindow, Plan *lefttree)
Sort * make_sort_from_sortclauses(List *sortcls, Plan *lefttree)
static BitmapOr * make_bitmap_or(List *bitmapplans)
static HashJoin * create_hashjoin_plan(PlannerInfo *root, HashPath *best_path)
static SeqScan * make_seqscan(List *qptlist, List *qpqual, Index scanrelid)
static TableFuncScan * create_tablefuncscan_plan(PlannerInfo *root, Path *best_path, List *tlist, List *scan_clauses)
static CustomScan * create_customscan_plan(PlannerInfo *root, CustomPath *best_path, List *tlist, List *scan_clauses)
static Node * fix_indexqual_operand(Node *node, IndexOptInfo *index, int indexcol)
static void fix_indexqual_references(PlannerInfo *root, IndexPath *index_path, List **stripped_indexquals_p, List **fixed_indexquals_p)
static List * fix_indexorderby_references(PlannerInfo *root, IndexPath *index_path)
static AttrNumber * remap_groupColIdx(PlannerInfo *root, List *groupClause)
static Plan * create_append_plan(PlannerInfo *root, AppendPath *best_path, int flags)
static void bitmap_subplan_mark_shared(Plan *plan)
static Unique * create_unique_plan(PlannerInfo *root, UniquePath *best_path, int flags)
static Result * make_one_row_result(List *tlist, Node *resconstantqual, RelOptInfo *rel)
static TidScan * make_tidscan(List *qptlist, List *qpqual, Index scanrelid, List *tidquals)
static MergeJoin * create_mergejoin_plan(PlannerInfo *root, MergePath *best_path)
static Plan * create_plan_recurse(PlannerInfo *root, Path *best_path, int flags)
static void label_sort_with_costsize(PlannerInfo *root, Sort *plan, double limit_tuples)
static ForeignScan * create_foreignscan_plan(PlannerInfo *root, ForeignPath *best_path, List *tlist, List *scan_clauses)
static BitmapHeapScan * create_bitmap_scan_plan(PlannerInfo *root, BitmapHeapPath *best_path, List *tlist, List *scan_clauses)
static IncrementalSort * make_incrementalsort(Plan *lefttree, int numCols, int nPresortedCols, AttrNumber *sortColIdx, Oid *sortOperators, Oid *collations, bool *nullsFirst)
static Result * create_group_result_plan(PlannerInfo *root, GroupResultPath *best_path)
static Limit * create_limit_plan(PlannerInfo *root, LimitPath *best_path, int flags)
static Unique * make_unique_from_pathkeys(Plan *lefttree, List *pathkeys, int numCols, Relids relids)
static Agg * create_agg_plan(PlannerInfo *root, AggPath *best_path)
bool is_projection_capable_path(Path *path)
static CteScan * make_ctescan(List *qptlist, List *qpqual, Index scanrelid, int ctePlanId, int cteParam)
static TidScan * create_tidscan_plan(PlannerInfo *root, TidPath *best_path, List *tlist, List *scan_clauses)
static TidRangeScan * make_tidrangescan(List *qptlist, List *qpqual, Index scanrelid, List *tidrangequals)
static Plan * create_bitmap_subplan(PlannerInfo *root, Path *bitmapqual, List **qual, List **indexqual, List **indexECs)
static RecursiveUnion * make_recursive_union(List *tlist, Plan *lefttree, Plan *righttree, int wtParam, List *distinctList, Cardinality numGroups)
static Node * fix_indexqual_clause(PlannerInfo *root, IndexOptInfo *index, int indexcol, Node *clause, List *indexcolnos)
static WorkTableScan * create_worktablescan_plan(PlannerInfo *root, Path *best_path, List *tlist, List *scan_clauses)
static Plan * create_gating_plan(PlannerInfo *root, Path *path, Plan *plan, List *gating_quals)
static Memoize * make_memoize(Plan *lefttree, Oid *hashoperators, Oid *collations, List *param_exprs, bool singlerow, bool binary_mode, uint32 est_entries, Bitmapset *keyparamids, Cardinality est_calls, Cardinality est_unique_keys, double est_hit_ratio)
static FunctionScan * create_functionscan_plan(PlannerInfo *root, Path *best_path, List *tlist, List *scan_clauses)
static Result * create_resultscan_plan(PlannerInfo *root, Path *best_path, List *tlist, List *scan_clauses)
static BitmapHeapScan * make_bitmap_heapscan(List *qptlist, List *qpqual, Plan *lefttree, List *bitmapqualorig, Index scanrelid)
static Node * replace_nestloop_params_mutator(Node *node, PlannerInfo *root)
static SetOp * create_setop_plan(PlannerInfo *root, SetOpPath *best_path, int flags)
bool is_projection_capable_plan(Plan *plan)
static CteScan * create_ctescan_plan(PlannerInfo *root, Path *best_path, List *tlist, List *scan_clauses)
static Sort * create_sort_plan(PlannerInfo *root, SortPath *best_path, int flags)
static ProjectSet * make_project_set(List *tlist, Plan *subplan)
static Sort * make_sort_from_pathkeys(Plan *lefttree, List *pathkeys, Relids relids)
static HashJoin * make_hashjoin(List *tlist, List *joinclauses, List *otherclauses, List *hashclauses, List *hashoperators, List *hashcollations, List *hashkeys, Plan *lefttree, Plan *righttree, JoinType jointype, bool inner_unique)
static Gather * make_gather(List *qptlist, List *qpqual, int nworkers, int rescan_param, bool single_copy, Plan *subplan)
static Gather * create_gather_plan(PlannerInfo *root, GatherPath *best_path)
static Sort * make_sort(Plan *lefttree, int numCols, AttrNumber *sortColIdx, Oid *sortOperators, Oid *collations, bool *nullsFirst)
Limit * make_limit(Plan *lefttree, Node *limitOffset, Node *limitCount, LimitOption limitOption, int uniqNumCols, AttrNumber *uniqColIdx, Oid *uniqOperators, Oid *uniqCollations)
static ProjectSet * create_project_set_plan(PlannerInfo *root, ProjectSetPath *best_path)
static void label_incrementalsort_with_costsize(PlannerInfo *root, IncrementalSort *plan, List *pathkeys, double limit_tuples)
static SetOp * make_setop(SetOpCmd cmd, SetOpStrategy strategy, List *tlist, Plan *lefttree, Plan *righttree, List *groupList, Cardinality numGroups)
ForeignScan * make_foreignscan(List *qptlist, List *qpqual, Index scanrelid, List *fdw_exprs, List *fdw_private, List *fdw_scan_tlist, List *fdw_recheck_quals, Plan *outer_plan)
static Group * create_group_plan(PlannerInfo *root, GroupPath *best_path)
static ModifyTable * create_modifytable_plan(PlannerInfo *root, ModifyTablePath *best_path)
static Result * create_minmaxagg_plan(PlannerInfo *root, MinMaxAggPath *best_path)
static LockRows * create_lockrows_plan(PlannerInfo *root, LockRowsPath *best_path, int flags)
static Material * create_material_plan(PlannerInfo *root, MaterialPath *best_path, int flags)
static List * get_gating_quals(PlannerInfo *root, List *quals)
static Plan * create_scan_plan(PlannerInfo *root, Path *best_path, int flags)
static Group * make_group(List *tlist, List *qual, int numGroupCols, AttrNumber *grpColIdx, Oid *grpOperators, Oid *grpCollations, Plan *lefttree)
static LockRows * make_lockrows(Plan *lefttree, List *rowMarks, int epqParam)
static IncrementalSort * create_incrementalsort_plan(PlannerInfo *root, IncrementalSortPath *best_path, int flags)
static NamedTuplestoreScan * create_namedtuplestorescan_plan(PlannerInfo *root, Path *best_path, List *tlist, List *scan_clauses)
static Plan * create_projection_plan(PlannerInfo *root, ProjectionPath *best_path, int flags)
static IndexOnlyScan * make_indexonlyscan(List *qptlist, List *qpqual, Index scanrelid, Oid indexid, List *indexqual, List *recheckqual, List *indexorderby, List *indextlist, ScanDirection indexscandir)
static List * build_path_tlist(PlannerInfo *root, Path *path)
static IndexScan * make_indexscan(List *qptlist, List *qpqual, Index scanrelid, Oid indexid, List *indexqual, List *indexqualorig, List *indexorderby, List *indexorderbyorig, List *indexorderbyops, ScanDirection indexscandir)
static FunctionScan * make_functionscan(List *qptlist, List *qpqual, Index scanrelid, List *functions, bool funcordinality)
static TableFuncScan * make_tablefuncscan(List *qptlist, List *qpqual, Index scanrelid, TableFunc *tablefunc)
static SubqueryScan * create_subqueryscan_plan(PlannerInfo *root, SubqueryScanPath *best_path, List *tlist, List *scan_clauses)
static Plan * inject_projection_plan(Plan *subplan, List *tlist, bool parallel_safe)
static TidRangeScan * create_tidrangescan_plan(PlannerInfo *root, TidRangePath *best_path, List *tlist, List *scan_clauses)
static List * get_switched_clauses(List *clauses, Relids outerrelids)
static void copy_plan_costsize(Plan *dest, Plan *src)
static ValuesScan * make_valuesscan(List *qptlist, List *qpqual, Index scanrelid, List *values_lists)
Plan * materialize_finished_plan(Plan *subplan)
static SampleScan * make_samplescan(List *qptlist, List *qpqual, Index scanrelid, TableSampleClause *tsc)
static NestLoop * create_nestloop_plan(PlannerInfo *root, NestPath *best_path)
static Memoize * create_memoize_plan(PlannerInfo *root, MemoizePath *best_path, int flags)
static Result * make_gating_result(List *tlist, Node *resconstantqual, Plan *subplan)
Agg * make_agg(List *tlist, List *qual, AggStrategy aggstrategy, AggSplit aggsplit, int numGroupCols, AttrNumber *grpColIdx, Oid *grpOperators, Oid *grpCollations, List *groupingSets, List *chain, Cardinality numGroups, Size transitionSpace, Plan *lefttree)
static NamedTuplestoreScan * make_namedtuplestorescan(List *qptlist, List *qpqual, Index scanrelid, char *enrname)
static bool mark_async_capable_plan(Plan *plan, Path *path)
static Material * make_material(Plan *lefttree)
Plan * change_plan_targetlist(Plan *subplan, List *tlist, bool tlist_parallel_safe)
static NestLoop * make_nestloop(List *tlist, List *joinclauses, List *otherclauses, List *nestParams, Plan *lefttree, Plan *righttree, JoinType jointype, bool inner_unique)
static BitmapIndexScan * make_bitmap_indexscan(Index scanrelid, Oid indexid, List *indexqual, List *indexqualorig)
static SubqueryScan * make_subqueryscan(List *qptlist, List *qpqual, Index scanrelid, Plan *subplan)
static Hash * make_hash(Plan *lefttree, List *hashkeys, Oid skewTable, AttrNumber skewColumn, bool skewInherit)
static WindowAgg * create_windowagg_plan(PlannerInfo *root, WindowAggPath *best_path)
static Node * replace_nestloop_params(PlannerInfo *root, Node *expr)
static BitmapAnd * make_bitmap_and(List *bitmapplans)
static Plan * create_groupingsets_plan(PlannerInfo *root, GroupingSetsPath *best_path)
static RecursiveUnion * create_recursiveunion_plan(PlannerInfo *root, RecursiveUnionPath *best_path)
static Sort * make_sort_from_groupcols(List *groupcls, AttrNumber *grpColIdx, Plan *lefttree)
static Scan * create_indexscan_plan(PlannerInfo *root, IndexPath *best_path, List *tlist, List *scan_clauses, bool indexonly)
static Plan * prepare_sort_from_pathkeys(Plan *lefttree, List *pathkeys, Relids relids, const AttrNumber *reqColIdx, bool adjust_tlist_in_place, int *p_numsortkeys, AttrNumber **p_sortColIdx, Oid **p_sortOperators, Oid **p_collations, bool **p_nullsFirst)
static IncrementalSort * make_incrementalsort_from_pathkeys(Plan *lefttree, List *pathkeys, Relids relids, int nPresortedCols)
static SampleScan * create_samplescan_plan(PlannerInfo *root, Path *best_path, List *tlist, List *scan_clauses)
Plan * create_plan(PlannerInfo *root, Path *best_path)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
bool equal(const void *a, const void *b)
bool is_redundant_with_indexclauses(RestrictInfo *rinfo, List *indexclauses)
EquivalenceMember * find_ec_member_matching_expr(EquivalenceClass *ec, Expr *expr, Relids relids)
EquivalenceMember * find_computable_ec_member(PlannerInfo *root, EquivalenceClass *ec, List *exprs, Relids relids, bool require_parallel_safe)
bool is_redundant_derived_clause(RestrictInfo *rinfo, List *clauselist)
#define CUSTOMPATH_SUPPORT_PROJECTION
#define palloc_array(type, count)
#define palloc0_array(type, count)
FdwRoutine * GetFdwRoutineByRelId(Oid relid)
Node * strip_phvs_in_index_operand(Node *operand)
List * list_difference(const List *list1, const List *list2)
List * lappend(List *list, void *datum)
List * list_difference_ptr(const List *list1, const List *list2)
List * list_concat(List *list1, const List *list2)
List * list_concat_copy(const List *list1, const List *list2)
List * list_copy(const List *oldlist)
List * lappend_oid(List *list, Oid datum)
bool list_member_ptr(const List *list, const void *datum)
bool list_member(const List *list, const void *datum)
List * list_copy_head(const List *oldlist, int len)
List * list_concat_unique(List *list1, const List *list2)
char * get_rel_name(Oid relid)
Oid get_opfamily_member_for_cmptype(Oid opfamily, Oid lefttype, Oid righttype, CompareType cmptype)
Datum lca(PG_FUNCTION_ARGS)
Datum subpath(PG_FUNCTION_ARGS)
Expr * make_orclause(List *orclauses)
Expr * make_ands_explicit(List *andclauses)
Var * makeVar(int varno, AttrNumber varattno, Oid vartype, int32 vartypmod, Oid varcollid, Index varlevelsup)
Node * makeBoolConst(bool value, bool isnull)
TargetEntry * makeTargetEntry(Expr *expr, AttrNumber resno, char *resname, bool resjunk)
void * palloc0(Size size)
Oid exprType(const Node *expr)
Oid exprCollation(const Node *expr)
#define expression_tree_mutator(n, m, c)
static bool is_opclause(const void *clause)
#define IsA(nodeptr, _type_)
#define IS_OUTER_JOIN(jointype)
#define castNode(_type_, nodeptr)
void process_subquery_nestloop_params(PlannerInfo *root, List *subplan_params)
List * identify_current_nestloop_params(PlannerInfo *root, Relids leftrelids, Relids outerrelids)
Param * replace_nestloop_param_placeholdervar(PlannerInfo *root, PlaceHolderVar *phv)
int assign_special_exec_param(PlannerInfo *root)
Param * replace_nestloop_param_var(PlannerInfo *root, Var *var)
TargetEntry * get_tle_by_resno(List *tlist, AttrNumber resno)
int make_partition_pruneinfo(PlannerInfo *root, RelOptInfo *parentrel, List *subpaths, List *prunequal)
bool pathkeys_count_contained_in(List *keys1, List *keys2, int *n_common)
bool pathkeys_contained_in(List *keys1, List *keys2)
Path * reparameterize_path_by_child(PlannerInfo *root, Path *path, RelOptInfo *child_rel)
#define IS_DUMMY_APPEND(p)
#define PATH_REQ_OUTER(path)
#define planner_rt_fetch(rti, root)
#define IS_OTHER_REL(rel)
#define IS_UPPER_REL(rel)
int errdetail_relkind_not_supported(char relkind)
#define lfirst_node(type, lc)
static int list_length(const List *l)
#define forboth(cell1, list1, cell2, list2)
#define for_each_from(cell, lst, N)
static ListCell * list_head(const List *l)
static ListCell * lnext(const List *l, const ListCell *c)
static int list_nth_int(const List *list, int n)
PlaceHolderInfo * find_placeholder_info(PlannerInfo *root, PlaceHolderVar *phv)
bool has_stored_generated_columns(PlannerInfo *root, Index rti)
bool has_row_triggers(PlannerInfo *root, Index rti, CmdType event)
List * build_physical_tlist(PlannerInfo *root, RelOptInfo *rel)
bool has_transition_tables(PlannerInfo *root, Index rti, CmdType event)
List * infer_arbiter_indexes(PlannerInfo *root)
int restrict_nonsystem_relation_kind
bool predicate_implied_by(List *predicate_list, List *clause_list, bool weak)
List * extract_update_targetlist_colnos(List *tlist)
#define IS_SPECIAL_VARNO(varno)
static const struct fns functions
List * extract_actual_clauses(List *restrictinfo_list, bool pseudoconstant)
void extract_actual_join_clauses(List *restrictinfo_list, Relids joinrelids, List **joinquals, List **otherquals)
List * get_actual_clauses(List *restrictinfo_list)
bool trivial_subqueryscan(SubqueryScan *plan)
void check_stack_depth(void)
Bitmapset * custom_relids
const struct CustomScanMethods * methods
BeginDirectModify_function BeginDirectModify
PlanForeignModify_function PlanForeignModify
PlanDirectModify_function PlanDirectModify
IterateDirectModify_function IterateDirectModify
EndDirectModify_function EndDirectModify
IsForeignPathAsyncCapable_function IsForeignPathAsyncCapable
Bitmapset * fs_base_relids
ScanDirection indexorderdir
ScanDirection indexorderdir
Cardinality est_unique_keys
List * mergeJoinConditions
Bitmapset * fdwDirectModifyPlans
List * withCheckOptionLists
OnConflictAction onConflictAction
struct PathTarget * reltarget
struct TableSampleClause * tablesample
SubqueryScanStatus scanstatus
void SS_attach_initplans(PlannerInfo *root, Plan *plan)
void SS_compute_initplan_cost(List *init_plans, Cost *initplan_cost_p, bool *unsafe_initplans_p)
void SS_make_initplan_from_plan(PlannerInfo *root, PlannerInfo *subroot, Plan *plan, Param *prm)
#define FirstLowInvalidHeapAttributeNumber
#define RESTRICT_RELKIND_FOREIGN_TABLE
Oid * extract_grouping_ops(List *groupClause)
TargetEntry * tlist_member(Expr *node, List *targetlist)
bool tlist_same_exprs(List *tlist1, List *tlist2)
void apply_tlist_labeling(List *dest_tlist, List *src_tlist)
void apply_pathtarget_labeling_to_tlist(List *tlist, PathTarget *target)
AttrNumber * extract_grouping_cols(List *groupClause, List *tlist)
TargetEntry * get_sortgroupclause_tle(SortGroupClause *sgClause, List *targetList)
TargetEntry * get_sortgroupref_tle(Index sortref, List *targetList)
Oid * extract_grouping_collations(List *groupClause, List *tlist)
#define FirstNormalObjectId
void pull_varattnos(Node *node, Index varno, Bitmapset **varattnos)
bool contain_vars_returning_old_or_new(Node *node)