66 #define CP_EXACT_TLIST 0x0001
67 #define CP_SMALL_TLIST 0x0002
68 #define CP_LABEL_TLIST 0x0004
121 List *tlist,
List *scan_clauses,
bool indexonly);
151 List *subplan_params);
160 double limit_tuples);
166 List *indexorderby,
List *indexorderbyorig,
167 List *indexorderbyops,
171 List *indexqual,
List *indexorderby,
176 List *indexqualorig);
180 List *bitmapqualorig,
193 Index scanrelid,
int ctePlanId,
int cteParam);
195 Index scanrelid,
int wtParam);
206 List *joinclauses,
List *otherclauses,
List *nestParams,
210 List *joinclauses,
List *otherclauses,
219 int32 skewColTypmod);
221 List *joinclauses,
List *otherclauses,
224 Oid *mergecollations,
225 int *mergestrategies,
226 bool *mergenullsfirst,
231 Oid *collations,
bool *nullsFirst);
235 bool adjust_tlist_in_place,
238 Oid **p_sortOperators,
240 bool **p_nullsFirst);
252 int frameOptions,
Node *startOffset,
Node *endOffset,
259 List *pathkeys,
int numCols);
261 int nworkers,
bool single_copy,
Plan *subplan);
268 CmdType operation,
bool canSetTag,
269 Index nominalRelation,
270 List *resultRelations,
List *subplans,
271 List *withCheckOptionLists,
List *returningLists,
329 elog(
ERROR,
"failed to assign all NestLoopParams to plan nodes");
470 elog(
ERROR,
"unrecognized node type: %d",
488 List *gating_clauses;
509 scan_clauses = ((
IndexPath *) best_path)->indexinfo->indrestrictinfo;
666 elog(
ERROR,
"unrecognized node type: %d",
766 for (i = rel->
min_attr; i <= 0; i++)
805 if (expr &&
IsA(expr,
Var))
807 int attno = ((
Var *) expr)->varattno;
865 (
Node *) gating_quals,
894 List *gating_clauses;
911 elog(
ERROR,
"unrecognized node type: %d",
934 if (get_loc_restrictinfo(best_path) !=
NIL)
935 set_qpqual((
Plan) plan,
983 foreach(subpaths, best_path->
subpaths)
991 subplans =
lappend(subplans, subplan);
1005 return (
Plan *) plan;
1053 foreach(subpaths, best_path->
subpaths)
1087 elog(
ERROR,
"MergeAppend child's targetlist doesn't match MergeAppend");
1089 numsortkeys *
sizeof(
Oid)) == 0);
1091 numsortkeys *
sizeof(
Oid)) == 0);
1093 numsortkeys *
sizeof(
bool)) == 0);
1099 sortColIdx, sortOperators,
1100 collations, nullsFirst);
1103 subplan = (
Plan *) sort;
1106 subplans =
lappend(subplans, subplan);
1111 return (
Plan *) node;
1222 foreach(l, uniq_exprs)
1234 newtlist =
lappend(newtlist, tle);
1265 foreach(l, uniq_exprs)
1272 elog(
ERROR,
"failed to find unique expression in subplan tlist");
1273 groupColIdx[groupColPos++] = tle->
resno;
1278 Oid *groupOperators;
1286 groupOperators = (
Oid *)
palloc(numGroupCols *
sizeof(
Oid));
1288 foreach(l, in_operators)
1294 elog(
ERROR,
"could not find compatible hash operator for operator %u",
1296 groupOperators[groupColPos++] = eq_oper;
1325 foreach(l, in_operators)
1335 elog(
ERROR,
"could not find ordering operator for equality operator %u",
1346 elog(
ERROR,
"could not find equality operator for ordering operator %u",
1350 groupColIdx[groupColPos]);
1356 sortcl->
eqop = eqop;
1360 sortList =
lappend(sortList, sortcl);
1645 foreach(lc, groupClause)
1652 return new_grpColIdx;
1740 forboth(lc, rollup_groupclauses, lc2, rollup_lists)
1754 sort_plan = (
Plan *)
1779 chain =
lappend(chain, agg_plan);
1814 return (
Plan *) plan;
1994 Oid **partOperators,
2002 if (numSortCols == numPart + numOrder)
2005 *partNumCols = numPart;
2006 *partColIdx = sortColIdx;
2008 *ordNumCols = numOrder;
2009 *ordColIdx = sortColIdx + numPart;
2022 *partOperators = (
Oid *)
palloc(numPart *
sizeof(
Oid));
2025 *ordOperators = (
Oid *)
palloc(numOrder *
sizeof(
Oid));
2034 sortclauses =
lappend(sortclauses, sgc);
2041 (*partColIdx)[*partNumCols] = sortColIdx[scidx++];
2042 (*partOperators)[*partNumCols] = sgc->
eqop;
2044 pathkeys = new_pathkeys;
2052 sortclauses =
lappend(sortclauses, sgc);
2059 (*ordColIdx)[*ordNumCols] = sortColIdx[scidx++];
2060 (*ordOperators)[*ordNumCols] = sgc->
eqop;
2062 pathkeys = new_pathkeys;
2066 if (scidx != numSortCols)
2067 elog(
ERROR,
"failed to deconstruct sort operators into partitioning/ordering operators");
2092 numGroups = (long)
Min(best_path->
numGroups, (
double) LONG_MAX);
2129 numGroups = (long)
Min(best_path->
numGroups, (
double) LONG_MAX);
2204 subplans =
lappend(subplans, subplan);
2281 scan_clauses = (
List *)
2324 scan_clauses = (
List *)
2363 List *stripped_indexquals;
2364 List *fixed_indexquals;
2365 List *fixed_indexorderbys;
2419 foreach(l, scan_clauses)
2433 qpqual =
lappend(qpqual, rinfo);
2453 stripped_indexquals = (
List *)
2457 indexorderbys = (
List *)
2489 elog(
ERROR,
"failed to find sort operator for ORDER BY expression");
2490 indexorderbyops =
lappend_oid(indexorderbyops, sortop);
2501 fixed_indexorderbys,
2510 stripped_indexquals,
2511 fixed_indexorderbys,
2533 Plan *bitmapqualplan;
2534 List *bitmapqualorig;
2547 &bitmapqualorig, &indexquals,
2577 foreach(l, scan_clauses)
2592 qpqual =
lappend(qpqual, rinfo);
2618 bitmapqualorig = (
List *)
2684 &subqual, &subindexqual,
2686 subplans =
lappend(subplans, subplan);
2690 subindexECs =
list_concat(subindexECs, subindexEC);
2700 *indexqual = subindexquals;
2701 *indexECs = subindexECs;
2709 bool const_true_subqual =
false;
2710 bool const_true_subindexqual =
false;
2730 &subqual, &subindexqual,
2732 subplans =
lappend(subplans, subplan);
2734 const_true_subqual =
true;
2735 else if (!const_true_subqual)
2738 if (subindexqual ==
NIL)
2739 const_true_subindexqual =
true;
2740 else if (!const_true_subindexqual)
2741 subindexquals =
lappend(subindexquals,
2769 if (const_true_subqual)
2775 if (const_true_subindexqual)
2778 *indexqual = subindexquals;
2821 *indexqual =
lappend(*indexqual, pred);
2832 *indexECs = subindexECs;
2872 scan_clauses = (
List *)
2880 ortidquals = tidquals;
2929 scan_clauses = (
List *)
2974 scan_clauses = (
List *)
3017 scan_clauses = (
List *)
3020 values_lists = (
List *)
3062 while (levelsup-- > 0)
3092 if (ctesplan->
plan_id == plan_id)
3113 scan_clauses = (
List *)
3117 scan_plan =
make_ctescan(tlist, scan_clauses, scan_relid,
3118 plan_id, cte_param_id);
3155 while (levelsup-- > 0)
3173 scan_clauses = (
List *)
3218 rel_oid = rte->
relid;
3236 tlist, scan_clauses,
3254 if (scan_relid == 0)
3343 custom_plans =
lappend(custom_plans, plan);
3438 &joinclauses, &otherclauses);
3450 joinclauses = (
List *)
3452 otherclauses = (
List *)
3473 nestParams =
lappend(nestParams, nlp);
3485 nestParams =
lappend(nestParams, nlp);
3515 List *outerpathkeys;
3516 List *innerpathkeys;
3519 Oid *mergecollations;
3520 int *mergestrategies;
3521 bool *mergenullsfirst;
3548 &joinclauses, &otherclauses);
3570 joinclauses = (
List *)
3572 otherclauses = (
List *)
3593 outer_plan = (
Plan *) sort;
3605 inner_plan = (
Plan *) sort;
3627 inner_plan = matplan;
3638 mergefamilies = (
Oid *)
palloc(nClauses *
sizeof(
Oid));
3639 mergecollations = (
Oid *)
palloc(nClauses *
sizeof(
Oid));
3640 mergestrategies = (
int *)
palloc(nClauses *
sizeof(
int));
3641 mergenullsfirst = (
bool *)
palloc(nClauses *
sizeof(
bool));
3688 if (oeclass == opeclass)
3696 foreach(l2, outerpathkeys)
3702 if (oeclass == opeclass)
3705 if (oeclass != opeclass)
3706 elog(
ERROR,
"outer pathkeys do not match mergeclauses");
3714 foreach(l2, outerpathkeys)
3718 if (oeclass == opeclass)
3722 elog(
ERROR,
"outer pathkeys do not match mergeclauses");
3729 if (ieclass == ipeclass)
3737 foreach(l2, innerpathkeys)
3743 if (ieclass == ipeclass)
3746 if (ieclass != ipeclass)
3747 elog(
ERROR,
"inner pathkeys do not match mergeclauses");
3755 foreach(l2, innerpathkeys)
3759 if (ieclass == ipeclass)
3763 elog(
ERROR,
"inner pathkeys do not match mergeclauses");
3771 elog(
ERROR,
"left and right pathkeys do not match in mergejoin");
3822 bool skewInherit =
false;
3824 int32 skewColTypmod = -1;
3848 &joinclauses, &otherclauses);
3870 joinclauses = (
List *)
3872 otherclauses = (
List *)
3908 skewTable = rte->
relid;
3910 skewInherit = rte->
inh;
3997 return (
Node *) param;
4006 return (
Node *) param;
4048 return (
Node *) newphv;
4060 return (
Node *) param;
4069 return (
Node *) param;
4094 foreach(ppl, subplan_params)
4106 elog(
ERROR,
"non-LATERAL parameter required by subquery");
4111 if (nlp->paramno == pitem->
paramId)
4122 nlp->paramno = pitem->
paramId;
4136 elog(
ERROR,
"non-LATERAL parameter required by subquery");
4141 if (nlp->paramno == pitem->
paramId)
4152 nlp->paramno = pitem->
paramId;
4158 elog(
ERROR,
"unexpected type of subquery parameter");
4185 List *fixed_indexquals;
4189 fixed_indexquals =
NIL;
4212 elog(
ERROR,
"indexqual clause is not binary opclause");
4252 if (newrc != (
Expr *) rc)
4253 elog(
ERROR,
"inconsistent results from adjust_rowcompare_for_index");
4294 elog(
ERROR,
"unsupported indexqual type: %d",
4297 fixed_indexquals =
lappend(fixed_indexquals, clause);
4300 return fixed_indexquals;
4318 List *fixed_indexorderbys;
4322 fixed_indexorderbys =
NIL;
4342 elog(
ERROR,
"indexorderby clause is not binary opclause");
4352 elog(
ERROR,
"unsupported indexorderby type: %d",
4355 fixed_indexorderbys =
lappend(fixed_indexorderbys, clause);
4358 return fixed_indexorderbys;
4384 Assert(indexcol >= 0 && indexcol < index->ncolumns);
4391 ((
Var *) node)->varattno == index->
indexkeys[indexcol])
4396 return (
Node *) result;
4399 elog(
ERROR,
"index key does not match expected index column");
4404 for (pos = 0; pos < index->
ncolumns; pos++)
4408 if (indexpr_item ==
NULL)
4409 elog(
ERROR,
"too few entries in indexprs list");
4410 if (pos == indexcol)
4417 if (
equal(node, indexkey))
4423 return (
Node *) result;
4426 elog(
ERROR,
"index key does not match expected index column");
4428 indexpr_item =
lnext(indexpr_item);
4433 elog(
ERROR,
"index key does not match expected index column");
4477 t_list =
lappend(t_list, temp);
4483 t_list =
lappend(t_list, clause);
4534 items = (QualItem *)
palloc(nitems *
sizeof(QualItem));
4536 foreach(lc, clauses)
4542 items[
i].clause = clause;
4552 for (i = 1; i < nitems; i++)
4554 QualItem newitem = items[
i];
4558 for (j = i; j > 0; j--)
4560 if (newitem.cost >= items[j - 1].cost)
4562 items[j] = items[j - 1];
4569 for (i = 0; i < nitems; i++)
4570 result =
lappend(result, items[i].clause);
4658 plan->
qual = qpqual;
4676 plan->
qual = qpqual;
4691 List *indexqualorig,
4693 List *indexorderbyorig,
4694 List *indexorderbyops,
4701 plan->
qual = qpqual;
4730 plan->
qual = qpqual;
4747 List *indexqualorig)
4768 List *bitmapqualorig,
4775 plan->
qual = qpqual;
4794 plan->
qual = qpqual;
4813 plan->
qual = qpqual;
4827 bool funcordinality)
4833 plan->
qual = qpqual;
4853 plan->
qual = qpqual;
4873 plan->
qual = qpqual;
4893 plan->
qual = qpqual;
4908 List *fdw_scan_tlist,
4909 List *fdw_recheck_quals,
4917 plan->
qual = qpqual;
4984 foreach(slitem, distinctList)
4990 dupColIdx[keyno] = tle->
resno;
4991 dupOperators[keyno] = sortcl->
eqop;
5046 plan->
qual = otherclauses;
5069 plan->
qual = otherclauses;
5085 int32 skewColTypmod)
5110 Oid *mergecollations,
5111 int *mergestrategies,
5112 bool *mergenullsfirst,
5121 plan->
qual = otherclauses;
5144 Oid *collations,
bool *nullsFirst)
5206 bool adjust_tlist_in_place,
5209 Oid **p_sortOperators,
5211 bool **p_nullsFirst)
5226 sortOperators = (
Oid *)
palloc(numsortkeys *
sizeof(
Oid));
5227 collations = (
Oid *)
palloc(numsortkeys *
sizeof(
Oid));
5228 nullsFirst = (
bool *)
palloc(numsortkeys *
sizeof(
bool));
5232 foreach(i, pathkeys)
5250 elog(
ERROR,
"volatile EquivalenceClass has no sortref");
5256 else if (reqColIdx !=
NULL)
5351 foreach(k, exprvars)
5364 elog(
ERROR,
"could not find pathkey item to sort");
5369 if (!adjust_tlist_in_place &&
5378 adjust_tlist_in_place =
true;
5400 elog(
ERROR,
"could not find member %d(%u,%u) of opfamily %u",
5405 sortColIdx[numsortkeys] = tle->
resno;
5406 sortOperators[numsortkeys] = sortop;
5413 *p_numsortkeys = numsortkeys;
5414 *p_sortColIdx = sortColIdx;
5415 *p_sortOperators = sortOperators;
5416 *p_collations = collations;
5417 *p_nullsFirst = nullsFirst;
5465 if (
equal(emexpr, tlexpr))
5501 sortColIdx, sortOperators,
5502 collations, nullsFirst);
5526 sortOperators = (
Oid *)
palloc(numsortkeys *
sizeof(
Oid));
5527 collations = (
Oid *)
palloc(numsortkeys *
sizeof(
Oid));
5528 nullsFirst = (
bool *)
palloc(numsortkeys *
sizeof(
bool));
5536 sortColIdx[numsortkeys] = tle->
resno;
5537 sortOperators[numsortkeys] = sortcl->
sortop;
5544 sortColIdx, sortOperators,
5545 collations, nullsFirst);
5577 sortOperators = (
Oid *)
palloc(numsortkeys *
sizeof(
Oid));
5578 collations = (
Oid *)
palloc(numsortkeys *
sizeof(
Oid));
5579 nullsFirst = (
bool *)
palloc(numsortkeys *
sizeof(
bool));
5582 foreach(l, groupcls)
5588 elog(
ERROR,
"could not retrieve tle for sort-from-groupcols");
5590 sortColIdx[numsortkeys] = tle->
resno;
5591 sortOperators[numsortkeys] = grpcl->
sortop;
5598 sortColIdx, sortOperators,
5599 collations, nullsFirst);
5650 bool combineStates,
bool finalizeAggs,
bool serialStates,
5653 double dNumGroups,
Plan *lefttree)
5660 numGroups = (long)
Min(dNumGroups, (
double) LONG_MAX);
5671 node->
chain = chain;
5683 int partNumCols,
AttrNumber *partColIdx,
Oid *partOperators,
5685 int frameOptions,
Node *startOffset,
Node *endOffset,
5763 foreach(slitem, distinctList)
5768 uniqColIdx[keyno] = tle->
resno;
5769 uniqOperators[keyno] = sortcl->
eqop;
5808 foreach(lc, pathkeys)
5819 if (keyno >= numCols)
5830 elog(
ERROR,
"volatile EquivalenceClass has no sortref");
5858 elog(
ERROR,
"could not find pathkey item to sort");
5869 elog(
ERROR,
"could not find member %d(%u,%u) of opfamily %u",
5873 uniqColIdx[keyno] = tle->
resno;
5874 uniqOperators[keyno] = eqop;
5897 plan->
qual = qpqual;
5938 foreach(slitem, distinctList)
5943 dupColIdx[keyno] = tle->
resno;
5944 dupOperators[keyno] = sortcl->
eqop;
6009 Node *resconstantqual,
6030 CmdType operation,
bool canSetTag,
6031 Index nominalRelation,
6032 List *resultRelations,
List *subplans,
6033 List *withCheckOptionLists,
List *returningLists,
6037 List *fdw_private_list;
6059 node->
plans = subplans;
6095 fdw_private_list =
NIL;
6096 direct_modify_plans =
NULL;
6098 foreach(lc, resultRelations)
6112 if (rti < root->simple_rel_array_size &&
6134 direct_modify =
false;
6135 if (fdwroutine !=
NULL &&
6145 if (!direct_modify &&
6146 fdwroutine !=
NULL &&
6151 fdw_private_list =
lappend(fdw_private_list, fdw_private);
static Plan * create_unique_plan(PlannerInfo *root, UniquePath *best_path, int flags)
GetForeignPlan_function GetForeignPlan
static Result * create_minmaxagg_plan(PlannerInfo *root, MinMaxAggPath *best_path)
static Unique * make_unique_from_sortclauses(Plan *lefttree, List *distinctList)
void cost_qual_eval_node(QualCost *cost, Node *qual, PlannerInfo *root)
EndDirectModify_function EndDirectModify
static BitmapHeapScan * create_bitmap_scan_plan(PlannerInfo *root, BitmapHeapPath *best_path, List *tlist, List *scan_clauses)
static ForeignScan * create_foreignscan_plan(PlannerInfo *root, ForeignPath *best_path, List *tlist, List *scan_clauses)
void apply_tlist_labeling(List *dest_tlist, List *src_tlist)
static Result * create_result_plan(PlannerInfo *root, ResultPath *best_path)
bool get_compatible_hash_operators(Oid opno, Oid *lhs_opno, Oid *rhs_opno)
Index assignSortGroupRef(TargetEntry *tle, List *tlist)
ScanDirection indexorderdir
static Group * create_group_plan(PlannerInfo *root, GroupPath *best_path)
#define IsA(nodeptr, _type_)
Bitmapset * fdwDirectModifyPlans
OnConflictExpr * onconflict
TargetEntry * get_sortgroupclause_tle(SortGroupClause *sgClause, List *targetList)
static Node * replace_nestloop_params(PlannerInfo *root, Node *expr)
Node * expression_tree_mutator(Node *node, Node *(*mutator)(), void *context)
#define forboth(cell1, list1, cell2, list2)
bool is_redundant_derived_clause(RestrictInfo *rinfo, List *clauselist)
static CustomScan * create_customscan_plan(PlannerInfo *root, CustomPath *best_path, List *tlist, List *scan_clauses)
static List * get_switched_clauses(List *clauses, Relids outerrelids)
bool predicate_implied_by(List *predicate_list, List *restrictinfo_list)
static Sort * create_sort_plan(PlannerInfo *root, SortPath *best_path, int flags)
static WorkTableScan * make_worktablescan(List *qptlist, List *qpqual, Index scanrelid, int wtParam)
static RecursiveUnion * make_recursive_union(List *tlist, Plan *lefttree, Plan *righttree, int wtParam, List *distinctList, long numGroups)
void extract_actual_join_clauses(List *restrictinfo_list, List **joinquals, List **otherquals)
static SeqScan * make_seqscan(List *qptlist, List *qpqual, Index scanrelid)
bool equal(const void *a, const void *b)
List * make_pathkeys_for_sortclauses(PlannerInfo *root, List *sortclauses, List *tlist)
List * withCheckOptionLists
static Plan * create_scan_plan(PlannerInfo *root, Path *best_path, int flags)
Expr * adjust_rowcompare_for_index(RowCompareExpr *clause, IndexOptInfo *index, int indexcol, List **indexcolnos, bool *var_on_left_p)
static LockRows * create_lockrows_plan(PlannerInfo *root, LockRowsPath *best_path, int flags)
static AttrNumber * remap_groupColIdx(PlannerInfo *root, List *groupClause)
struct Plan *(* PlanCustomPath)(PlannerInfo *root, RelOptInfo *rel, struct CustomPath *best_path, List *tlist, List *clauses, List *custom_plans)
static HashJoin * make_hashjoin(List *tlist, List *joinclauses, List *otherclauses, List *hashclauses, Plan *lefttree, Plan *righttree, JoinType jointype)
Oid get_equality_op_for_ordering_op(Oid opno, bool *reverse)
List * list_difference_ptr(const List *list1, const List *list2)
TargetEntry * tlist_member_ignore_relabel(Node *node, List *targetlist)
static RecursiveUnion * create_recursiveunion_plan(PlannerInfo *root, RecursiveUnionPath *best_path)
static Agg * create_agg_plan(PlannerInfo *root, AggPath *best_path)
struct TableSampleClause * tablesample
#define IS_OUTER_JOIN(jointype)
ParamPathInfo * param_info
bool wholePlanParallelSafe
List * list_copy(const List *oldlist)
static Plan * inject_projection_plan(Plan *subplan, List *tlist)
List * get_actual_clauses(List *restrictinfo_list)
static Unique * create_upper_unique_plan(PlannerInfo *root, UpperUniquePath *best_path, int flags)
void CommuteOpExpr(OpExpr *clause)
List * list_concat(List *list1, List *list2)
static List * order_qual_clauses(PlannerInfo *root, List *clauses)
#define FirstLowInvalidHeapAttributeNumber
EquivalenceClass * right_ec
Agg * make_agg(List *tlist, List *qual, AggStrategy aggstrategy, bool combineStates, bool finalizeAggs, bool serialStates, int numGroupCols, AttrNumber *grpColIdx, Oid *grpOperators, List *groupingSets, List *chain, double dNumGroups, Plan *lefttree)
List * pull_var_clause(Node *node, int flags)
static Plan * create_bitmap_subplan(PlannerInfo *root, Path *bitmapqual, List **qual, List **indexqual, List **indexECs)
Selectivity bitmapselectivity
Oid * extract_grouping_ops(List *groupClause)
AttrNumber * grouping_map
static BitmapAnd * make_bitmap_and(List *bitmapplans)
List * lappend_oid(List *list, Oid datum)
#define OidIsValid(objectId)
static Gather * make_gather(List *qptlist, List *qpqual, int nworkers, bool single_copy, Plan *subplan)
void pull_varattnos(Node *node, Index varno, Bitmapset **varattnos)
AttrNumber * extract_grouping_cols(List *groupClause, List *tlist)
static ModifyTable * create_modifytable_plan(PlannerInfo *root, ModifyTablePath *best_path)
bool is_projection_capable_plan(Plan *plan)
#define PVC_INCLUDE_AGGREGATES
static NestLoop * create_nestloop_plan(PlannerInfo *root, NestPath *best_path)
struct RelOptInfo ** simple_rel_array
void * copyObject(const void *from)
static Unique * make_unique_from_pathkeys(Plan *lefttree, List *pathkeys, int numCols)
Expr * make_ands_explicit(List *andclauses)
IterateDirectModify_function IterateDirectModify
Plan * create_plan(PlannerInfo *root, Path *best_path)
#define PVC_INCLUDE_PLACEHOLDERS
TargetEntry * tlist_member(Node *node, List *targetlist)
static BitmapHeapScan * make_bitmap_heapscan(List *qptlist, List *qpqual, Plan *lefttree, List *bitmapqualorig, Index scanrelid)
static Plan * create_plan_recurse(PlannerInfo *root, Path *best_path, int flags)
static Material * make_material(Plan *lefttree)
const struct CustomPathMethods * methods
static void copy_generic_path_info(Plan *dest, Path *src)
#define planner_rt_fetch(rti, root)
static Node * replace_nestloop_params_mutator(Node *node, PlannerInfo *root)
static void get_column_info_for_window(PlannerInfo *root, WindowClause *wc, List *tlist, int numSortCols, AttrNumber *sortColIdx, int *partNumCols, AttrNumber **partColIdx, Oid **partOperators, int *ordNumCols, AttrNumber **ordColIdx, Oid **ordOperators)
bool list_member(const List *list, const void *datum)
static List * build_path_tlist(PlannerInfo *root, Path *path)
#define is_opclause(clause)
static Plan * create_projection_plan(PlannerInfo *root, ProjectionPath *best_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)
Node * makeBoolConst(bool value, bool isnull)
EquivalenceClass * parent_ec
bool bms_is_subset(const Bitmapset *a, const Bitmapset *b)
static Plan * create_join_plan(PlannerInfo *root, JoinPath *best_path)
static WindowAgg * make_windowagg(List *tlist, Index winref, int partNumCols, AttrNumber *partColIdx, Oid *partOperators, int ordNumCols, AttrNumber *ordColIdx, Oid *ordOperators, int frameOptions, Node *startOffset, Node *endOffset, Plan *lefttree)
Selectivity indexselectivity
PlaceHolderInfo * find_placeholder_info(PlannerInfo *root, PlaceHolderVar *phv, bool create_new_ph)
struct FdwRoutine * fdwroutine
Plan * materialize_finished_plan(Plan *subplan)
Datum sort(PG_FUNCTION_ARGS)
Oid get_opfamily_member(Oid opfamily, Oid lefttype, Oid righttype, int16 strategy)
static void copy_plan_costsize(Plan *dest, Plan *src)
static TidScan * make_tidscan(List *qptlist, List *qpqual, Index scanrelid, List *tidquals)
static Group * make_group(List *tlist, List *qual, int numGroupCols, AttrNumber *grpColIdx, Oid *grpOperators, Plan *lefttree)
static ListCell * list_head(const List *l)
static Sort * make_sort_from_groupcols(List *groupcls, AttrNumber *grpColIdx, Plan *lefttree)
ScanDirection indexorderdir
static SeqScan * create_seqscan_plan(PlannerInfo *root, Path *best_path, List *tlist, List *scan_clauses)
#define RELKIND_FOREIGN_TABLE
Oid get_ordering_op_for_equality_op(Oid opno, bool use_lhs_type)
static SetOp * make_setop(SetOpCmd cmd, SetOpStrategy strategy, Plan *lefttree, List *distinctList, AttrNumber flagColIdx, int firstFlag, long numGroups)
Selectivity bitmapselectivity
PlanForeignModify_function PlanForeignModify
static SubqueryScan * create_subqueryscan_plan(PlannerInfo *root, SubqueryScanPath *best_path, List *tlist, List *scan_clauses)
static CteScan * create_ctescan_plan(PlannerInfo *root, Path *best_path, List *tlist, List *scan_clauses)
TargetEntry * makeTargetEntry(Expr *expr, AttrNumber resno, char *resname, bool resjunk)
static List * fix_indexorderby_references(PlannerInfo *root, IndexPath *index_path)
TargetEntry * get_sortgroupref_tle(Index sortref, List *targetList)
static List * fix_indexqual_references(PlannerInfo *root, IndexPath *index_path)
Var * makeVar(Index varno, AttrNumber varattno, Oid vartype, int32 vartypmod, Oid varcollid, Index varlevelsup)
static Result * make_result(List *tlist, Node *resconstantqual, Plan *subplan)
List * lappend(List *list, void *datum)
List * build_physical_tlist(PlannerInfo *root, RelOptInfo *rel)
RangeTblEntry ** simple_rte_array
static SampleScan * make_samplescan(List *qptlist, List *qpqual, Index scanrelid, TableSampleClause *tsc)
struct PlannerInfo * parent_root
bool bms_is_empty(const Bitmapset *a)
PlanDirectModify_function PlanDirectModify
static NestLoop * make_nestloop(List *tlist, List *joinclauses, List *otherclauses, List *nestParams, Plan *lefttree, Plan *righttree, JoinType jointype)
void apply_pathtarget_labeling_to_tlist(List *tlist, PathTarget *target)
List * list_delete_cell(List *list, ListCell *cell, ListCell *prev)
bool pathkeys_contained_in(List *keys1, List *keys2)
BeginDirectModify_function BeginDirectModify
List * rollup_groupclauses
static CteScan * make_ctescan(List *qptlist, List *qpqual, Index scanrelid, int ctePlanId, int cteParam)
void * palloc0(Size size)
int list_nth_int(const List *list, int n)
FdwRoutine * GetFdwRoutineByRelId(Oid relid)
#define PVC_INCLUDE_WINDOWFUNCS
void cost_sort(Path *path, PlannerInfo *root, List *pathkeys, Cost input_cost, double tuples, int width, Cost comparison_cost, int sort_mem, double limit_tuples)
Param * assign_nestloop_param_var(PlannerInfo *root, Var *var)
static BitmapOr * make_bitmap_or(List *bitmapplans)
static TidScan * create_tidscan_plan(PlannerInfo *root, TidPath *best_path, List *tlist, List *scan_clauses)
bool hasPseudoConstantQuals
static SubqueryScan * make_subqueryscan(List *qptlist, List *qpqual, Index scanrelid, Plan *subplan)
static SetOp * create_setop_plan(PlannerInfo *root, SetOpPath *best_path, int flags)
bool list_member_ptr(const List *list, const void *datum)
void cost_material(Path *path, Cost input_startup_cost, Cost input_total_cost, double tuples, int width)
void bms_free(Bitmapset *a)
static Sort * make_sort(Plan *lefttree, int numCols, AttrNumber *sortColIdx, Oid *sortOperators, Oid *collations, bool *nullsFirst)
static FunctionScan * make_functionscan(List *qptlist, List *qpqual, Index scanrelid, List *functions, bool funcordinality)
static IndexOnlyScan * make_indexonlyscan(List *qptlist, List *qpqual, Index scanrelid, Oid indexid, List *indexqual, List *indexorderby, List *indextlist, ScanDirection indexscandir)
#define Assert(condition)
static HashJoin * create_hashjoin_plan(PlannerInfo *root, HashPath *best_path)
static Gather * create_gather_plan(PlannerInfo *root, GatherPath *best_path)
static ModifyTable * make_modifytable(PlannerInfo *root, CmdType operation, bool canSetTag, Index nominalRelation, List *resultRelations, List *subplans, List *withCheckOptionLists, List *returningLists, List *rowMarks, OnConflictExpr *onconflict, int epqParam)
Datum lca(PG_FUNCTION_ARGS)
static Plan * create_append_plan(PlannerInfo *root, AppendPath *best_path)
OnConflictAction onConflictAction
static Node * fix_indexqual_operand(Node *node, IndexOptInfo *index, int indexcol)
EquivalenceClass * pk_eclass
static WindowAgg * create_windowagg_plan(PlannerInfo *root, WindowAggPath *best_path)
static Material * create_material_plan(PlannerInfo *root, MaterialPath *best_path, int flags)
Bitmapset * bms_union(const Bitmapset *a, const Bitmapset *b)
Oid exprType(const Node *expr)
List * infer_arbiter_indexes(PlannerInfo *root)
static int list_length(const List *l)
List * extract_actual_clauses(List *restrictinfo_list, bool pseudoconstant)
Oid exprCollation(const Node *expr)
void SS_attach_initplans(PlannerInfo *root, Plan *plan)
static const struct fns functions
static SampleScan * create_samplescan_plan(PlannerInfo *root, Path *best_path, List *tlist, List *scan_clauses)
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 FunctionScan * create_functionscan_plan(PlannerInfo *root, Path *best_path, List *tlist, List *scan_clauses)
List * list_concat_unique(List *list1, List *list2)
List * list_difference(const List *list1, const List *list2)
Bitmapset * bms_add_member(Bitmapset *a, int x)
void SS_make_initplan_from_plan(PlannerInfo *root, PlannerInfo *subroot, Plan *plan, Param *prm)
Bitmapset * custom_relids
static Plan * create_gating_plan(PlannerInfo *root, Path *path, Plan *plan, List *gating_quals)
bool tlist_same_exprs(List *tlist1, List *tlist2)
#define InvalidAttrNumber
static Sort * make_sort_from_pathkeys(Plan *lefttree, List *pathkeys)
static BitmapIndexScan * make_bitmap_indexscan(Index scanrelid, Oid indexid, List *indexqual, List *indexqualorig)
Limit * make_limit(Plan *lefttree, Node *limitOffset, Node *limitCount)
static EquivalenceMember * find_ec_member_for_tle(EquivalenceClass *ec, TargetEntry *tle, Relids relids)
static MergeJoin * make_mergejoin(List *tlist, List *joinclauses, List *otherclauses, List *mergeclauses, Oid *mergefamilies, Oid *mergecollations, int *mergestrategies, bool *mergenullsfirst, Plan *lefttree, Plan *righttree, JoinType jointype)
List * withCheckOptionLists
bool bms_overlap(const Bitmapset *a, const Bitmapset *b)
static bool use_physical_tlist(PlannerInfo *root, Path *path, int flags)
bool is_projection_capable_path(Path *path)
EquivalenceClass * left_ec
static Hash * make_hash(Plan *lefttree, Oid skewTable, AttrNumber skewColumn, bool skewInherit, Oid skewColType, int32 skewColTypmod)
void CommuteRowCompareExpr(RowCompareExpr *clause)
ScanDirection indexscandir
Sort * make_sort_from_sortclauses(List *sortcls, Plan *lefttree)
void list_free(List *list)
static Plan * create_groupingsets_plan(PlannerInfo *root, GroupingSetsPath *best_path)
TargetEntry * get_tle_by_resno(List *tlist, AttrNumber resno)
bool contain_mutable_functions(Node *clause)
static Limit * create_limit_plan(PlannerInfo *root, LimitPath *best_path, int flags)
static WorkTableScan * create_worktablescan_plan(PlannerInfo *root, Path *best_path, List *tlist, List *scan_clauses)
static MergeJoin * create_mergejoin_plan(PlannerInfo *root, MergePath *best_path)
static ValuesScan * make_valuesscan(List *qptlist, List *qpqual, Index scanrelid, List *values_lists)
bool has_row_triggers(PlannerInfo *root, Index rti, CmdType event)
static LockRows * make_lockrows(Plan *lefttree, List *rowMarks, int epqParam)
double clamp_row_est(double nrows)
bool bms_is_member(int x, const Bitmapset *a)
struct PathTarget * reltarget
struct TableSampleClause * tablesample
static ValuesScan * create_valuesscan_plan(PlannerInfo *root, Path *best_path, List *tlist, List *scan_clauses)
static void label_sort_with_costsize(PlannerInfo *root, Sort *plan, double limit_tuples)
Expr * make_orclause(List *orclauses)
static Scan * create_indexscan_plan(PlannerInfo *root, IndexPath *best_path, List *tlist, List *scan_clauses, bool indexonly)
static Plan * create_merge_append_plan(PlannerInfo *root, MergeAppendPath *best_path)
#define BTEqualStrategyNumber
Param * assign_nestloop_param_placeholdervar(PlannerInfo *root, PlaceHolderVar *phv)
Datum subpath(PG_FUNCTION_ARGS)
static List * get_gating_quals(PlannerInfo *root, List *quals)
static void process_subquery_nestloop_params(PlannerInfo *root, List *subplan_params)
bool bms_equal(const Bitmapset *a, const Bitmapset *b)
bool bms_nonempty_difference(const Bitmapset *a, const Bitmapset *b)
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 Append * make_append(List *appendplans, List *tlist)