69#define CP_EXACT_TLIST 0x0001
70#define CP_SMALL_TLIST 0x0002
71#define CP_LABEL_TLIST 0x0004
72#define CP_IGNORE_TLIST 0x0008
178 double limit_tuples);
180 List *pathkeys,
double limit_tuples);
186 List *indexorderby,
List *indexorderbyorig,
187 List *indexorderbyops,
197 List *indexqualorig);
201 List *bitmapqualorig,
218 Index scanrelid,
int ctePlanId,
int cteParam);
220 Index scanrelid,
char *enrname);
222 Index scanrelid,
int wtParam);
234 JoinType jointype,
bool inner_unique);
238 List *hashoperators,
List *hashcollations,
241 JoinType jointype,
bool inner_unique);
255 JoinType jointype,
bool inner_unique,
256 bool skip_mark_restore);
261 int numCols,
int nPresortedCols,
276 List *pathkeys,
Relids relids,
int nPresortedCols);
282 Oid *collations,
List *param_exprs,
283 bool singlerow,
bool binary_mode,
287 double est_hit_ratio);
291 List *runCondition,
List *qual,
bool topWindow,
297 List *pathkeys,
int numCols,
300 int nworkers,
int rescan_param,
bool single_copy,
Plan *subplan);
311 CmdType operation,
bool canSetTag,
313 List *resultRelations,
314 List *updateColnosLists,
315 List *withCheckOptionLists,
List *returningLists,
317 List *mergeActionLists,
List *mergeJoinConditions,
373 if (
root->curOuterParams !=
NIL)
374 elog(
ERROR,
"failed to assign all NestLoopParams to plan nodes");
537 elog(
ERROR,
"unrecognized node type: %d",
793 elog(
ERROR,
"unrecognized node type: %d",
824 foreach(v, path->pathtarget->exprs)
835 if (path->param_info)
904 path->pathtarget->exprs ==
NIL)
922 foreach(
lc,
root->placeholder_list)
942 if (!indexinfo->canreturn[
i])
961 foreach(
lc, path->pathtarget->exprs)
965 if (path->pathtarget->sortgrouprefs[
i])
967 if (expr &&
IsA(expr,
Var))
969 int attno = ((
Var *) expr)->varattno;
997 if (!
root->hasPseudoConstantQuals)
1064 return &gplan->
plan;
1093 elog(
ERROR,
"unrecognized node type: %d",
1159 FdwRoutine *fdwroutine = path->parent->fdwroutine;
1195 plan->async_capable =
true;
1217 int nasyncplans = 0;
1262 plan->plan.targetlist = tlist;
1267 plan->child_append_relid_sets =
best_path->child_append_relid_sets;
1269 if (pathkeys !=
NIL)
1307 if (pathkeys !=
NIL)
1341 elog(
ERROR,
"Append child's targetlist doesn't match Append");
1363 sortColIdx, sortOperators,
1374 sortColIdx, sortOperators,
1392 subplans =
lappend(subplans, subplan);
1396 plan->part_prune_index = -1;
1426 plan->appendplans = subplans;
1427 plan->nasyncplans = nasyncplans;
1441 plan->plan.parallel_safe);
1475 plan->targetlist = tlist;
1494 &node->sortOperators,
1537 if (
memcmp(sortColIdx, node->sortColIdx,
1539 elog(
ERROR,
"MergeAppend child's targetlist doesn't match MergeAppend");
1561 sortColIdx, sortOperators,
1572 sortColIdx, sortOperators,
1582 subplans =
lappend(subplans, subplan);
1732 operators =
palloc(nkeys *
sizeof(
Oid));
1733 collations =
palloc(nkeys *
sizeof(
Oid));
1741 operators[
i] = opno;
1791 root->glob->parallelModeNeeded =
true;
1815 gm_plan->plan.targetlist = tlist;
1843 gm_plan->plan.lefttree = subplan;
1846 root->glob->parallelModeNeeded =
true;
1974 plan->parallel_safe = parallel_safe;
2214 foreach(
lc, groupClause)
2266 foreach(
lc,
root->processed_groupClause)
2277 foreach(
lc,
root->processed_groupClause)
2427 plan->disabled_nodes =
mminfo->path->disabled_nodes;
2428 plan->startup_cost =
mminfo->path->startup_cost;
2430 plan->plan_rows = 1;
2431 plan->plan_width =
mminfo->path->pathtarget->width;
2432 plan->parallel_aware =
false;
2433 plan->parallel_safe =
mminfo->path->parallel_safe;
2717 foreach(l,
parse->sortClause)
2917 if (rinfo->pseudoconstant)
2949 indexorderbys = (
List *)
2981 elog(
ERROR,
"missing operator %d(%u,%u) in opfamily %u",
2983 indexorderbyops =
lappend_oid(indexorderbyops, sortop);
3000 indextle->resjunk = !indexinfo->canreturn[
i];
3046 List *bitmapqualorig;
3059 &bitmapqualorig, &indexquals,
3097 if (rinfo->pseudoconstant)
3132 bitmapqualorig = (
List *)
3190 foreach(l,
apath->bitmapquals)
3200 subplans =
lappend(subplans, subplan);
3207 plan->startup_cost =
apath->path.startup_cost;
3208 plan->total_cost =
apath->path.total_cost;
3211 plan->plan_width = 0;
3212 plan->parallel_aware =
false;
3213 plan->parallel_safe =
apath->path.parallel_safe;
3237 foreach(l,
opath->bitmapquals)
3247 subplans =
lappend(subplans, subplan);
3271 plan->startup_cost =
opath->path.startup_cost;
3272 plan->total_cost =
opath->path.total_cost;
3275 plan->plan_width = 0;
3276 plan->parallel_aware =
false;
3277 plan->parallel_safe =
opath->path.parallel_safe;
3318 plan->startup_cost = 0.0;
3319 plan->total_cost =
ipath->indextotalcost;
3322 plan->plan_width = 0;
3323 plan->parallel_aware =
false;
3324 plan->parallel_safe =
ipath->path.parallel_safe;
3329 foreach(l,
ipath->indexclauses)
3334 Assert(!rinfo->pseudoconstant);
3338 if (rinfo->parent_ec)
3342 foreach(l,
ipath->indexinfo->indpred)
3416 if (rinfo->pseudoconstant)
3498 if (rinfo->pseudoconstant)
3517 tidrangequals = (
List *)
3653 tablefunc =
rte->tablefunc;
3696 values_lists =
rte->values_lists;
3710 values_lists = (
List *)
3750 levelsup =
rte->ctelevelsup;
3752 while (levelsup-- > 0)
3756 elog(
ERROR,
"bad levelsup for CTE \"%s\"",
rte->ctename);
3774 elog(
ERROR,
"could not find CTE \"%s\"",
rte->ctename);
3776 elog(
ERROR,
"could not find plan for CTE \"%s\"",
rte->ctename);
3779 elog(
ERROR,
"no plan was made for CTE \"%s\"",
rte->ctename);
3787 elog(
ERROR,
"could not find plan for CTE \"%s\"",
rte->ctename);
3919 levelsup =
rte->ctelevelsup;
3921 elog(
ERROR,
"bad levelsup for CTE \"%s\"",
rte->ctename);
3924 while (levelsup-- > 0)
3928 elog(
ERROR,
"bad levelsup for CTE \"%s\"",
rte->ctename);
3931 elog(
ERROR,
"could not find param ID for CTE \"%s\"",
rte->ctename);
4033 root->outer_join_rels);
4041 root->glob->dependsOnRole =
true;
4211 best_path->jpath.outerjoinpath->parent);
4223 outerrelids =
best_path->jpath.outerjoinpath->parent->relids;
4253 joinclauses = (
List *)
4280 foreach(
lc, nestParams)
4408 joinclauses = (
List *)
4420 best_path->jpath.outerjoinpath->parent->relids);
4548 if (rinfo->outer_is_left)
4580 elog(
ERROR,
"outer pathkeys do not match mergeclauses");
4585 elog(
ERROR,
"outer pathkeys do not match mergeclauses");
4629 elog(
ERROR,
"inner pathkeys do not match mergeclauses");
4648 elog(
ERROR,
"left and right pathkeys do not match in mergejoin");
4652 elog(
ERROR,
"left and right pathkeys do not match in mergejoin");
4709 bool skewInherit =
false;
4757 joinclauses = (
List *)
4768 best_path->jpath.outerjoinpath->parent->relids);
4795 skewTable =
rte->relid;
4797 skewInherit =
rte->inh;
4810 foreach(
lc, hashclauses)
4841 if (
best_path->jpath.path.parallel_aware)
4914 root->curOuterRels))
4979 int indexcol =
iclause->indexcol;
5090 elog(
ERROR,
"unsupported indexqual type: %d",
5127 if (
index->indexkeys[indexcol] != 0)
5131 ((
Var *) node)->varno ==
index->rel->relid &&
5132 ((
Var *) node)->varattno ==
index->indexkeys[indexcol])
5137 return (
Node *) result;
5140 elog(
ERROR,
"index key does not match expected index column");
5145 for (pos = 0; pos <
index->ncolumns; pos++)
5147 if (
index->indexkeys[pos] == 0)
5150 elog(
ERROR,
"too few entries in indexprs list");
5151 if (pos == indexcol)
5164 return (
Node *) result;
5167 elog(
ERROR,
"index key does not match expected index column");
5174 elog(
ERROR,
"index key does not match expected index column");
5210 temp->opresulttype = clause->opresulttype;
5211 temp->opretset = clause->opretset;
5212 temp->opcollid = clause->opcollid;
5213 temp->inputcollid = clause->inputcollid;
5271 Index security_level;
5289 foreach(
lc, clauses)
5295 items[
i].clause = clause;
5312 items[
i].security_level = 0;
5317 items[
i].security_level = 0;
5332 for (
j =
i;
j > 0;
j--)
5336 if (newitem.security_level >
olditem->security_level ||
5337 (newitem.security_level ==
olditem->security_level &&
5338 newitem.cost >=
olditem->cost))
5364 dest->plan_rows = src->
rows;
5365 dest->plan_width = src->pathtarget->width;
5383 dest->parallel_aware =
false;
5406 plan->plan.disabled_nodes,
5417 plan->plan.parallel_aware =
false;
5427 List *pathkeys,
double limit_tuples)
5435 plan->nPresortedCols,
5436 plan->sort.plan.disabled_nodes,
5448 plan->sort.plan.parallel_aware =
false;
5529 List *indexqualorig,
5531 List *indexorderbyorig,
5532 List *indexorderbyops,
5587 List *indexqualorig)
5608 List *bitmapqualorig,
5616 plan->lefttree = lefttree;
5647 List *tidrangequals)
5687 bool funcordinality)
5807 List *fdw_scan_tlist,
5808 List *fdw_recheck_quals,
5817 plan->lefttree = outer_plan;
5853 plan->targetlist = tlist;
5855 plan->lefttree = lefttree;
5876 foreach(
slitem, distinctList)
5940 plan->targetlist = tlist;
5942 plan->lefttree = lefttree;
5957 List *hashoperators,
5958 List *hashcollations,
5968 plan->targetlist = tlist;
5970 plan->lefttree = lefttree;
5995 plan->lefttree = lefttree;
6019 bool skip_mark_restore)
6024 plan->targetlist = tlist;
6026 plan->lefttree = lefttree;
6061 plan->lefttree = lefttree;
6064 node->sortColIdx = sortColIdx;
6065 node->sortOperators = sortOperators;
6066 node->collations = collations;
6091 plan->lefttree = lefttree;
6095 node->
sort.sortColIdx = sortColIdx;
6096 node->
sort.sortOperators = sortOperators;
6097 node->
sort.collations = collations;
6174 foreach(
i, pathkeys)
6192 elog(
ERROR,
"volatile EquivalenceClass has no sortref");
6258 elog(
ERROR,
"could not find pathkey item to sort");
6296 elog(
ERROR,
"missing operator %d(%u,%u) in opfamily %u",
6348 sortColIdx, sortOperators,
6363 Relids relids,
int nPresortedCols)
6384 sortColIdx, sortOperators,
6427 sortColIdx, sortOperators,
6471 elog(
ERROR,
"could not retrieve tle for sort-from-groupcols");
6481 sortColIdx, sortOperators,
6493 plan->lefttree = lefttree;
6545 matplan->parallel_aware =
false;
6553 List *param_exprs,
bool singlerow,
bool binary_mode,
6556 double est_hit_ratio)
6563 plan->lefttree = lefttree;
6567 node->hashOperators = hashoperators;
6568 node->collations = collations;
6586 Size transitionSpace,
Plan *lefttree)
6601 node->
chain = chain;
6604 plan->targetlist = tlist;
6605 plan->lefttree = lefttree;
6615 List *runCondition,
List *qual,
bool topWindow,
Plan *lefttree)
6643 plan->targetlist = tlist;
6644 plan->lefttree = lefttree;
6669 plan->targetlist = tlist;
6670 plan->lefttree = lefttree;
6696 plan->lefttree = lefttree;
6709 foreach(
lc, pathkeys)
6720 if (keyno >= numCols)
6731 elog(
ERROR,
"volatile EquivalenceClass has no sortref");
6744 foreach(
j,
plan->targetlist)
6759 elog(
ERROR,
"could not find pathkey item to sort");
6770 elog(
ERROR,
"missing operator %d(%u,%u) in opfamily %u",
6802 plan->lefttree = subplan;
6833 plan->targetlist = tlist;
6835 plan->lefttree = lefttree;
6847 foreach(
slitem, groupList)
6887 plan->lefttree = lefttree;
6910 plan->lefttree = lefttree;
6931 Node *resconstantqual,
6939 plan->targetlist = tlist;
6941 plan->lefttree = subplan;
6962 Node *resconstantqual,
6993 plan->lefttree = subplan;
7005 CmdType operation,
bool canSetTag,
7007 List *resultRelations,
7008 List *updateColnosLists,
7009 List *withCheckOptionLists,
List *returningLists,
7011 List *mergeActionLists,
List *mergeJoinConditions,
7027 updateColnosLists ==
NIL));
7101 foreach(
lc, resultRelations)
7116 root->simple_rel_array[rti] !=
NULL)
7120 fdwroutine = resultRel->fdwroutine;
7136 errmsg(
"access to non-system foreign table is restricted")));
7158 errmsg(
"cannot execute MERGE on relation \"%s\"",
7172 if (fdwroutine !=
NULL &&
7177 withCheckOptionLists ==
NIL &&
7189 root->parse->returningList);
7210 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 * child_append_relid_sets
List * mergeJoinConditions
Bitmapset * fdwDirectModifyPlans
List * withCheckOptionLists
LockClauseStrength onConflictLockStrength
OnConflictAction onConflictAction
LockClauseStrength lockStrength
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)