1 /*-------------------------------------------------------------------------
2  *
3  * appendinfo.h
4  *	  Routines for mapping expressions between append rel parent(s) and
5  *	  children
6  *
7  * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  * src/include/optimizer/appendinfo.h
11  *
12  *-------------------------------------------------------------------------
13  */
14 #ifndef APPENDINFO_H
15 #define APPENDINFO_H
16 
17 #include "nodes/pathnodes.h"
18 #include "utils/relcache.h"
19 
20 extern AppendRelInfo *make_append_rel_info(Relation parentrel,
21 										   Relation childrel,
22 										   Index parentRTindex, Index childRTindex);
23 extern Node *adjust_appendrel_attrs(PlannerInfo *root, Node *node,
24 									int nappinfos, AppendRelInfo **appinfos);
25 extern Node *adjust_appendrel_attrs_multilevel(PlannerInfo *root, Node *node,
26 											   Relids child_relids,
27 											   Relids top_parent_relids);
28 extern Relids adjust_child_relids(Relids relids, int nappinfos,
29 								  AppendRelInfo **appinfos);
30 extern Relids adjust_child_relids_multilevel(PlannerInfo *root, Relids relids,
31 											 Relids child_relids,
32 											 Relids top_parent_relids);
33 extern List *adjust_inherited_attnums(List *attnums, AppendRelInfo *context);
34 extern List *adjust_inherited_attnums_multilevel(PlannerInfo *root,
35 												 List *attnums,
36 												 Index child_relid,
37 												 Index top_parent_relid);
38 extern void get_translated_update_targetlist(PlannerInfo *root, Index relid,
39 											 List **processed_tlist,
40 											 List **update_colnos);
41 extern AppendRelInfo **find_appinfos_by_relids(PlannerInfo *root,
42 											   Relids relids, int *nappinfos);
43 extern void add_row_identity_var(PlannerInfo *root, Var *rowid_var,
44 								 Index rtindex, const char *rowid_name);
45 extern void add_row_identity_columns(PlannerInfo *root, Index rtindex,
46 									 RangeTblEntry *target_rte,
47 									 Relation target_relation);
48 extern void distribute_row_identity_vars(PlannerInfo *root);
49 
50 #endif							/* APPENDINFO_H */
51