1 | /*------------------------------------------------------------------------- |
2 | * |
3 | * tlist.h |
4 | * prototypes for tlist.c. |
5 | * |
6 | * |
7 | * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group |
8 | * Portions Copyright (c) 1994, Regents of the University of California |
9 | * |
10 | * src/include/optimizer/tlist.h |
11 | * |
12 | *------------------------------------------------------------------------- |
13 | */ |
14 | #ifndef TLIST_H |
15 | #define TLIST_H |
16 | |
17 | #include "nodes/pathnodes.h" |
18 | |
19 | |
20 | extern TargetEntry *tlist_member(Expr *node, List *targetlist); |
21 | extern TargetEntry *tlist_member_ignore_relabel(Expr *node, List *targetlist); |
22 | |
23 | extern List *add_to_flat_tlist(List *tlist, List *exprs); |
24 | |
25 | extern List *get_tlist_exprs(List *tlist, bool includeJunk); |
26 | |
27 | extern bool tlist_same_exprs(List *tlist1, List *tlist2); |
28 | |
29 | extern bool tlist_same_datatypes(List *tlist, List *colTypes, bool junkOK); |
30 | extern bool tlist_same_collations(List *tlist, List *colCollations, bool junkOK); |
31 | |
32 | extern void apply_tlist_labeling(List *dest_tlist, List *src_tlist); |
33 | |
34 | extern Oid *(List *groupClause); |
35 | extern Oid *(List *groupClause, List *tlist); |
36 | extern AttrNumber *(List *groupClause, List *tlist); |
37 | extern bool grouping_is_sortable(List *groupClause); |
38 | extern bool grouping_is_hashable(List *groupClause); |
39 | |
40 | extern PathTarget *make_pathtarget_from_tlist(List *tlist); |
41 | extern List *make_tlist_from_pathtarget(PathTarget *target); |
42 | extern PathTarget *copy_pathtarget(PathTarget *src); |
43 | extern PathTarget *create_empty_pathtarget(void); |
44 | extern void add_column_to_pathtarget(PathTarget *target, |
45 | Expr *expr, Index sortgroupref); |
46 | extern void add_new_column_to_pathtarget(PathTarget *target, Expr *expr); |
47 | extern void add_new_columns_to_pathtarget(PathTarget *target, List *exprs); |
48 | extern void apply_pathtarget_labeling_to_tlist(List *tlist, PathTarget *target); |
49 | extern void split_pathtarget_at_srfs(PlannerInfo *root, |
50 | PathTarget *target, PathTarget *input_target, |
51 | List **targets, List **targets_contain_srfs); |
52 | |
53 | /* Convenience macro to get a PathTarget with valid cost/width fields */ |
54 | #define create_pathtarget(root, tlist) \ |
55 | set_pathtarget_cost_width(root, make_pathtarget_from_tlist(tlist)) |
56 | |
57 | #endif /* TLIST_H */ |
58 | |