80 #define ISREGCLASSCONST(con) \ 81 (((con)->consttype == REGCLASSOID || (con)->consttype == OIDOID) && \ 84 #define fix_scan_list(root, lst, rtoffset) \ 85 ((List *) fix_scan_expr(root, (Node *) (lst), rtoffset)) 129 Index acceptable_rel,
int rtoffset);
142 Index resultRelation,
240 newrc->
rti += rtoffset;
241 newrc->
prti += rtoffset;
299 rti < root->simple_rel_array_size)
328 else if (recursing ||
417 (
errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
418 errmsg(
"too many range table entries")));
680 rc->
prti += rtoffset;
715 plan->targetlist = (
List *)
718 plan->qual = (
List *)
870 rc->
prti += rtoffset;
872 foreach(l, splan->
plans)
992 elog(
ERROR,
"unrecognized node type: %d",
1049 pfree(index_itlist);
1051 return (
Plan *) plan;
1120 result = (
Plan *) plan;
1370 ((
Aggref *) node)->aggfnoid);
1386 ((
OpExpr *) node)->opfuncid);
1430 foreach(lc, g->
refs)
1456 int subqueryid = p->
paramid >> 16;
1457 int colno = p->
paramid & 0xFFFF;
1460 if (subqueryid <= 0 ||
1486 context.
root = root;
1489 if (rtoffset != 0 ||
1534 return (
Node *) var;
1568 return (
Node *) cexpr;
1644 elog(
ERROR,
"NestLoopParam was not reduced to a simple Var");
1713 pfree(outer_itlist);
1714 pfree(inner_itlist);
1740 List *output_targetlist;
1745 output_targetlist =
NIL;
1774 output_targetlist =
lappend(output_targetlist, tle);
1785 pfree(subplan_itlist);
1806 for (proot = root; proot != NULL; proot = proot->
parent_root)
1825 ((
Gather *) plan)->initParam =
1871 memcpy(child_agg, orig_agg,
sizeof(
Aggref));
1900 return (
Node *) parent_agg;
1922 List *output_targetlist;
1925 output_targetlist =
NIL;
1941 output_targetlist =
lappend(output_targetlist, tle);
1953 newvar->varnoold = oldvar->varno + rtoffset;
1954 newvar->varoattno = oldvar->varattno;
1958 newvar->varnoold = 0;
1959 newvar->varoattno = 0;
1964 output_targetlist =
lappend(output_targetlist, tle);
1997 itlist->
tlist = tlist;
2003 vinfo = itlist->
vars;
2053 itlist->
tlist = tlist;
2059 vinfo = itlist->
vars;
2068 if (var->
varno != ignore_rel)
2095 Index newvarno,
int rtoffset)
2102 vinfo = itlist->
vars;
2111 newvar->
varno = newvarno;
2181 foreach(lc, itlist->
tlist)
2242 Index acceptable_rel,
2247 context.
root = root;
2259 bool converted_whole_row;
2275 return (
Node *) newvar;
2286 return (
Node *) newvar;
2296 return (
Node *) var;
2300 elog(
ERROR,
"variable not found in subplan target lists");
2313 return (
Node *) newvar;
2321 return (
Node *) newvar;
2340 return (
Node *) newvar;
2350 return (
Node *) newvar;
2397 context.
root = root;
2420 elog(
ERROR,
"variable not found in subplan target list");
2421 return (
Node *) newvar;
2434 return (
Node *) newvar;
2472 return (
Node *) newvar;
2512 Index resultRelation,
2597 List **relationOids,
2599 bool *hasRowSecurity)
2605 MemSet(&glob, 0,
sizeof(glob));
2612 MemSet(&root, 0,
sizeof(root));
2652 foreach(lc, query->
rtable)
2668 (
void *) context, 0);
bool query_tree_walker(Query *query, bool(*walker)(), void *context, int flags)
#define ISREGCLASSCONST(con)
#define IsA(nodeptr, _type_)
indexed_tlist * inner_itlist
Node * expression_tree_mutator(Node *node, Node *(*mutator)(), void *context)
#define forboth(cell1, list1, cell2, list2)
static Node * fix_param_node(PlannerInfo *root, Param *p)
tlist_vinfo vars[FLEXIBLE_ARRAY_MEMBER]
static void flatten_unplanned_rtes(PlannerGlobal *glob, RangeTblEntry *rte)
bool equal(const void *a, const void *b)
List * withCheckOptionLists
#define castNode(_type_, nodeptr)
static void set_join_references(PlannerInfo *root, Join *join, int rtoffset)
int32 exprTypmod(const Node *expr)
#define forthree(cell1, list1, cell2, list2, cell3, list3)
#define DatumGetObjectId(X)
int bms_next_member(const Bitmapset *a, int prevbit)
void mark_partial_aggref(Aggref *agg, AggSplit aggsplit)
Var * makeVarFromTargetEntry(Index varno, TargetEntry *tle)
struct TableSampleClause * tablesample
List * list_copy(const List *oldlist)
int errcode(int sqlerrcode)
#define MemSet(start, val, len)
List * list_concat(List *list1, List *list2)
static void set_param_references(PlannerInfo *root, Plan *plan)
#define GetSysCacheHashValue1(cacheId, key1)
AttrNumber * grouping_map
List * lappend_oid(List *list, Oid datum)
#define OidIsValid(objectId)
#define DO_AGGSPLIT_COMBINE(as)
static bool trivial_subqueryscan(SubqueryScan *plan)
static Plan * set_plan_refs(PlannerInfo *root, Plan *plan, int rtoffset)
static Node * fix_join_expr_mutator(Node *node, fix_join_expr_context *context)
static void add_rte_to_flat_rtable(PlannerGlobal *glob, RangeTblEntry *rte)
struct RelOptInfo ** simple_rel_array
static void set_foreignscan_references(PlannerInfo *root, ForeignScan *fscan, int rtoffset)
static List * fix_join_expr(PlannerInfo *root, List *clauses, indexed_tlist *outer_itlist, indexed_tlist *inner_itlist, Index acceptable_rel, int rtoffset)
List * rootResultRelations
Query * UtilityContainsQuery(Node *parsetree)
void pfree(void *pointer)
#define IS_SPECIAL_VARNO(varno)
#define ObjectIdGetDatum(X)
static Node * fix_upper_expr_mutator(Node *node, fix_upper_expr_context *context)
RelOptInfo * fetch_upper_rel(PlannerInfo *root, UpperRelationKind kind, Relids relids)
#define lfirst_node(type, lc)
static bool flatten_rtes_walker(Node *node, PlannerGlobal *glob)
static Var * copyVar(Var *var)
void * list_nth(const List *list, int n)
#define FirstBootstrapObjectId
TargetEntry * flatCopyTargetEntry(TargetEntry *src_tle)
static void set_customscan_references(PlannerInfo *root, CustomScan *cscan, int rtoffset)
static Plan * set_subqueryscan_references(PlannerInfo *root, SubqueryScan *plan, int rtoffset)
static Node * fix_upper_expr(PlannerInfo *root, Node *node, indexed_tlist *subplan_itlist, Index newvarno, int rtoffset)
#define ereport(elevel, rest)
TargetEntry * makeTargetEntry(Expr *expr, AttrNumber resno, char *resname, bool resjunk)
Var * makeVar(Index varno, AttrNumber varattno, Oid vartype, int32 vartypmod, Oid varcollid, Index varlevelsup)
List * lappend_int(List *list, int datum)
List * lappend(List *list, void *datum)
struct PlannerInfo * parent_root
static bool fix_scan_expr_walker(Node *node, fix_scan_expr_context *context)
static Node * fix_scan_expr_mutator(Node *node, fix_scan_expr_context *context)
static Plan * set_indexonlyscan_references(PlannerInfo *root, IndexOnlyScan *plan, int rtoffset)
CoercionForm convertformat
static void set_upper_references(PlannerInfo *root, Plan *plan, int rtoffset)
Bitmapset * bms_intersect(const Bitmapset *a, const Bitmapset *b)
static bool extract_query_dependencies_walker(Node *node, PlannerInfo *context)
void record_plan_function_dependency(PlannerInfo *root, Oid funcid)
TargetEntry * tlist_member(Expr *node, List *targetlist)
static Var * search_indexed_tlist_for_non_var(Expr *node, indexed_tlist *itlist, Index newvarno)
static Node * convert_combining_aggrefs(Node *node, void *context)
static void fix_expr_common(PlannerInfo *root, Node *node)
List * nonleafResultRelations
#define Assert(condition)
static void add_rtes_to_flat_rtable(PlannerInfo *root, bool recursing)
void extract_query_dependencies(Node *query, List **relationOids, List **invalItems, bool *hasRowSecurity)
static Var * search_indexed_tlist_for_var(Var *var, indexed_tlist *itlist, Index newvarno, int rtoffset)
static indexed_tlist * build_tlist_index(List *tlist)
Oid exprType(const Node *expr)
bool expression_tree_walker(Node *node, bool(*walker)(), void *context)
static int list_length(const List *l)
Oid exprCollation(const Node *expr)
Bitmapset * bms_add_member(Bitmapset *a, int x)
Bitmapset * custom_relids
static indexed_tlist * build_tlist_index_other_vars(List *tlist, Index ignore_rel)
static List * set_returning_clause_references(PlannerInfo *root, List *rlist, Plan *topplan, Index resultRelation, int rtoffset)
int errmsg(const char *fmt,...)
void set_opfuncid(OpExpr *opexpr)
static Node * fix_scan_expr(PlannerInfo *root, Node *node, int rtoffset)
static bool is_converted_whole_row_reference(Node *node)
indexed_tlist * outer_itlist
Plan * set_plan_references(PlannerInfo *root, Plan *plan)
RelOptInfo * find_base_rel(PlannerInfo *root, int relid)
static Var * search_indexed_tlist_for_sortgroupref(Expr *node, Index sortgroupref, indexed_tlist *itlist, Index newvarno)
#define fix_scan_list(root, lst, rtoffset)
struct TableSampleClause * tablesample
void set_sa_opfuncid(ScalarArrayOpExpr *opexpr)
indexed_tlist * subplan_itlist
static void set_dummy_tlist_references(Plan *plan, int rtoffset)
#define offsetof(type, field)