aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2019-01-10 14:54:31 -0300
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2019-01-10 14:54:31 -0300
commitb60c39759908bb2a2dbcfc108ec19bdbdcc278e8 (patch)
treebdfa3231c4a98e58ab0fae1d36d9117658fc2d06 /src/include
parentdacadcd1f32873d930b3953d3055dc7cb9548e48 (diff)
downloadpostgresql-b60c39759908bb2a2dbcfc108ec19bdbdcc278e8.tar.gz
postgresql-b60c39759908bb2a2dbcfc108ec19bdbdcc278e8.zip
Move inheritance expansion code into its own file
This commit moves expand_inherited_tables and underlings from optimizer/prep/prepunionc.c to optimizer/utils/inherit.c. Also, all of the AppendRelInfo-based expression manipulation routines are moved to optimizer/utils/appendinfo.c. No functional code changes. One exception is the introduction of make_append_rel_info, but that's still just moving around code. Also, stop including <limits.h> in prepunion.c, which no longer needs it since 3fc6e2d7f5b6. I (Álvaro) noticed this because Amit was copying that to inherit.c, which likewise doesn't need it. Author: Amit Langote Discussion: https://postgr.es/m/3be67028-a00a-502c-199a-da00eec8fb6e@lab.ntt.co.jp
Diffstat (limited to 'src/include')
-rw-r--r--src/include/optimizer/appendinfo.h42
-rw-r--r--src/include/optimizer/inherit.h22
-rw-r--r--src/include/optimizer/prep.h18
3 files changed, 64 insertions, 18 deletions
diff --git a/src/include/optimizer/appendinfo.h b/src/include/optimizer/appendinfo.h
new file mode 100644
index 00000000000..2348c9c13a7
--- /dev/null
+++ b/src/include/optimizer/appendinfo.h
@@ -0,0 +1,42 @@
+/*-------------------------------------------------------------------------
+ *
+ * appendinfo.h
+ * Routines for mapping expressions between append rel parent(s) and
+ * children
+ *
+ * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/optimizer/appendinfo.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef APPENDINFO_H
+#define APPENDINFO_H
+
+#include "nodes/plannodes.h"
+#include "nodes/relation.h"
+#include "utils/relcache.h"
+
+extern AppendRelInfo *make_append_rel_info(Relation parentrel,
+ Relation childrel,
+ Index parentRTindex, Index childRTindex);
+extern Bitmapset *translate_col_privs(const Bitmapset *parent_privs,
+ List *translated_vars);
+extern Node *adjust_appendrel_attrs(PlannerInfo *root, Node *node,
+ int nappinfos, AppendRelInfo **appinfos);
+
+extern Node *adjust_appendrel_attrs_multilevel(PlannerInfo *root, Node *node,
+ Relids child_relids,
+ Relids top_parent_relids);
+
+extern AppendRelInfo **find_appinfos_by_relids(PlannerInfo *root,
+ Relids relids, int *nappinfos);
+
+extern SpecialJoinInfo *build_child_join_sjinfo(PlannerInfo *root,
+ SpecialJoinInfo *parent_sjinfo,
+ Relids left_relids, Relids right_relids);
+extern Relids adjust_child_relids_multilevel(PlannerInfo *root, Relids relids,
+ Relids child_relids, Relids top_parent_relids);
+
+#endif /* APPENDINFO_H */
diff --git a/src/include/optimizer/inherit.h b/src/include/optimizer/inherit.h
new file mode 100644
index 00000000000..b2687abd4e0
--- /dev/null
+++ b/src/include/optimizer/inherit.h
@@ -0,0 +1,22 @@
+/*-------------------------------------------------------------------------
+ *
+ * inherit.h
+ * prototypes for inherit.c.
+ *
+ *
+ * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/optimizer/inherit.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef INHERIT_H
+#define INHERIT_H
+
+#include "nodes/relation.h"
+
+
+extern void expand_inherited_tables(PlannerInfo *root);
+
+#endif /* INHERIT_H */
diff --git a/src/include/optimizer/prep.h b/src/include/optimizer/prep.h
index d6991d56905..62d45dd1426 100644
--- a/src/include/optimizer/prep.h
+++ b/src/include/optimizer/prep.h
@@ -47,22 +47,4 @@ extern PlanRowMark *get_plan_rowmark(List *rowmarks, Index rtindex);
*/
extern RelOptInfo *plan_set_operations(PlannerInfo *root);
-extern void expand_inherited_tables(PlannerInfo *root);
-
-extern Node *adjust_appendrel_attrs(PlannerInfo *root, Node *node,
- int nappinfos, AppendRelInfo **appinfos);
-
-extern Node *adjust_appendrel_attrs_multilevel(PlannerInfo *root, Node *node,
- Relids child_relids,
- Relids top_parent_relids);
-
-extern AppendRelInfo **find_appinfos_by_relids(PlannerInfo *root,
- Relids relids, int *nappinfos);
-
-extern SpecialJoinInfo *build_child_join_sjinfo(PlannerInfo *root,
- SpecialJoinInfo *parent_sjinfo,
- Relids left_relids, Relids right_relids);
-extern Relids adjust_child_relids_multilevel(PlannerInfo *root, Relids relids,
- Relids child_relids, Relids top_parent_relids);
-
#endif /* PREP_H */