72 foreach(temp, targetlist)
95 foreach(temp, targetlist)
161 if (tle->
resjunk && !includeJunk)
215 forboth(lc1, tlist1, lc2, tlist2)
253 if (curColType == NULL)
257 curColType =
lnext(colTypes, curColType);
260 if (curColType != NULL)
287 if (curColColl == NULL)
291 curColColl =
lnext(colCollations, curColColl);
294 if (curColColl != NULL)
313 forboth(ld, dest_tlist, ls, src_tlist)
338 foreach(l, targetList)
346 elog(
ERROR,
"ORDER/GROUP BY expression not found in targetlist");
386 foreach(l, sgClauses)
392 result =
lappend(result, sortexpr);
423 elog(
ERROR,
"ORDER/GROUP BY expression not found in list");
461 foreach(glitem, groupClause)
465 groupOperators[colno] = groupcl->
eqop;
470 return groupOperators;
487 foreach(glitem, groupClause)
495 return grpCollations;
512 foreach(glitem, groupClause)
517 grpColIdx[colno++] = tle->
resno;
533 foreach(glitem, groupClause)
553 foreach(glitem, groupClause)
620 foreach(lc, target->
exprs)
698 else if (sortgroupref)
773 foreach(lc, target->
exprs)
789 if (expr &&
IsA(expr,
Var))
801 elog(
ERROR,
"ORDER/GROUP BY expression not found in targetlist");
804 elog(
ERROR,
"targetlist item has multiple sortgroupref labels");
872 List **targets,
List **targets_contain_srfs)
876 bool need_extra_projection;
877 List *prev_level_tlist;
890 if (target == input_target)
915 need_extra_projection =
false;
919 foreach(lc, target->
exprs)
947 need_extra_projection =
false;
956 need_extra_projection =
true;
976 if (need_extra_projection)
998 *targets = *targets_contain_srfs =
NIL;
999 prev_level_tlist =
NIL;
1036 foreach(lcx, input_srfs)
1050 *targets =
lappend(*targets, ntarget);
1051 *targets_contain_srfs =
lappend_int(*targets_contain_srfs,
1052 (level_srfs !=
NIL));
1055 prev_level_tlist = ntarget->
exprs;
1201 foreach(lc, target->
exprs)
#define OidIsValid(objectId)
PathTarget * set_pathtarget_cost_width(PlannerInfo *root, PathTarget *target)
bool equal(const void *a, const void *b)
Assert(fmt[strlen(fmt) - 1] !='\n')
List * lappend(List *list, void *datum)
List * lappend_int(List *list, int datum)
List * list_copy(const List *oldlist)
List * list_concat(List *list1, const List *list2)
bool list_member(const List *list, const void *datum)
TargetEntry * makeTargetEntry(Expr *expr, AttrNumber resno, char *resname, bool resjunk)
void * palloc0(Size size)
void * repalloc(void *pointer, Size size)
Oid exprType(const Node *expr)
Oid exprCollation(const Node *expr)
bool expression_tree_walker(Node *node, bool(*walker)(), void *context)
#define IsA(nodeptr, _type_)
#define IS_SRF_CALL(node)
#define get_pathtarget_sortgroupref(target, colno)
static int list_length(const List *l)
#define forboth(cell1, list1, cell2, list2)
#define forthree(cell1, list1, cell2, list2, cell3, list3)
#define for_each_cell(cell, lst, initcell)
static ListCell * list_head(const List *l)
static ListCell * list_nth_cell(const List *list, int n)
static ListCell * lnext(const List *l, const ListCell *c)
#define list_make1_int(x1)
VolatileFunctionStatus has_volatile_expr
List * current_input_srfs
List * input_target_exprs
List * current_input_vars
bool tlist_same_collations(List *tlist, List *colCollations, bool junkOK)
List * get_sortgrouplist_exprs(List *sgClauses, List *targetList)
bool tlist_same_exprs(List *tlist1, List *tlist2)
TargetEntry * get_sortgroupref_tle(Index sortref, List *targetList)
void apply_tlist_labeling(List *dest_tlist, List *src_tlist)
Oid * extract_grouping_collations(List *groupClause, List *tlist)
PathTarget * copy_pathtarget(PathTarget *src)
SortGroupClause * get_sortgroupref_clause_noerr(Index sortref, List *clauses)
void apply_pathtarget_labeling_to_tlist(List *tlist, PathTarget *target)
List * get_tlist_exprs(List *tlist, bool includeJunk)
bool grouping_is_sortable(List *groupClause)
List * add_to_flat_tlist(List *tlist, List *exprs)
static void add_sp_item_to_pathtarget(PathTarget *target, split_pathtarget_item *item)
static bool split_pathtarget_walker(Node *node, split_pathtarget_context *context)
void add_new_columns_to_pathtarget(PathTarget *target, List *exprs)
PathTarget * create_empty_pathtarget(void)
static void add_sp_items_to_pathtarget(PathTarget *target, List *items)
Node * get_sortgroupclause_expr(SortGroupClause *sgClause, List *targetList)
Oid * extract_grouping_ops(List *groupClause)
TargetEntry * get_sortgroupclause_tle(SortGroupClause *sgClause, List *targetList)
AttrNumber * extract_grouping_cols(List *groupClause, List *tlist)
static TargetEntry * tlist_member_match_var(Var *var, List *targetlist)
int count_nonjunk_tlist_entries(List *tlist)
SortGroupClause * get_sortgroupref_clause(Index sortref, List *clauses)
void add_new_column_to_pathtarget(PathTarget *target, Expr *expr)
List * make_tlist_from_pathtarget(PathTarget *target)
TargetEntry * tlist_member(Expr *node, List *targetlist)
void split_pathtarget_at_srfs(PlannerInfo *root, PathTarget *target, PathTarget *input_target, List **targets, List **targets_contain_srfs)
PathTarget * make_pathtarget_from_tlist(List *tlist)
bool grouping_is_hashable(List *groupClause)
void add_column_to_pathtarget(PathTarget *target, Expr *expr, Index sortgroupref)
bool tlist_same_datatypes(List *tlist, List *colTypes, bool junkOK)