diff options
| author | Tom Lane | 2009-05-12 00:56:05 +0000 |
|---|---|---|
| committer | Tom Lane | 2009-05-12 00:56:05 +0000 |
| commit | 0ada559187d167fceb0ce438f332fd50852d0c13 (patch) | |
| tree | 94790f0a21c72426634e69578ee286444ea27ea3 /src/include | |
| parent | 6480c143ee067544730993d03e0eb567f3acd71e (diff) | |
Do some minor code refactoring in preparation for changing the APIs of
find_inheritance_children() and find_all_inheritors(). I got annoyed that
these are buried inside the planner but mostly used elsewhere. So, create
a new file catalog/pg_inherits.c and put them there, along with a couple
of other functions that search pg_inherits.
The code that modifies pg_inherits is (still) in tablecmds.c --- it's
kind of entangled with unrelated code that modifies pg_depend and other
stuff, so pulling it out seemed like a bigger change than I wanted to make
right now. But this file provides a natural home for it if anyone ever
gets around to that.
This commit just moves code around; it doesn't change anything, except
I succumbed to the temptation to make a couple of trivial optimizations
in typeInheritsFrom().
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/catalog/pg_inherits.h | 16 | ||||
| -rw-r--r-- | src/include/optimizer/plancat.h | 6 | ||||
| -rw-r--r-- | src/include/optimizer/prep.h | 4 | ||||
| -rw-r--r-- | src/include/parser/parse_func.h | 4 |
4 files changed, 18 insertions, 12 deletions
diff --git a/src/include/catalog/pg_inherits.h b/src/include/catalog/pg_inherits.h index 57959b5b2ff..42c3811ef3e 100644 --- a/src/include/catalog/pg_inherits.h +++ b/src/include/catalog/pg_inherits.h @@ -8,7 +8,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/pg_inherits.h,v 1.26 2009/01/01 17:23:57 momjian Exp $ + * $PostgreSQL: pgsql/src/include/catalog/pg_inherits.h,v 1.27 2009/05/12 00:56:05 tgl Exp $ * * NOTES * the genbki.sh script reads this file and generates .bki @@ -20,6 +20,7 @@ #define PG_INHERITS_H #include "catalog/genbki.h" +#include "nodes/pg_list.h" /* ---------------- * pg_inherits definition. cpp turns this into @@ -51,4 +52,17 @@ typedef FormData_pg_inherits *Form_pg_inherits; #define Anum_pg_inherits_inhparent 2 #define Anum_pg_inherits_inhseqno 3 +/* ---------------- + * pg_inherits has no initial contents + * ---------------- + */ + +/* + * prototypes for functions in pg_inherits.c + */ +extern List *find_inheritance_children(Oid parentrelId); +extern List *find_all_inheritors(Oid parentrelId); +extern bool has_subclass(Oid relationId); +extern bool typeInheritsFrom(Oid subclassTypeId, Oid superclassTypeId); + #endif /* PG_INHERITS_H */ diff --git a/src/include/optimizer/plancat.h b/src/include/optimizer/plancat.h index bc3b63e374d..e2d2b00d053 100644 --- a/src/include/optimizer/plancat.h +++ b/src/include/optimizer/plancat.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/optimizer/plancat.h,v 1.52 2009/01/01 17:24:00 momjian Exp $ + * $PostgreSQL: pgsql/src/include/optimizer/plancat.h,v 1.53 2009/05/12 00:56:05 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -36,10 +36,6 @@ extern bool relation_excluded_by_constraints(PlannerInfo *root, extern List *build_physical_tlist(PlannerInfo *root, RelOptInfo *rel); -extern List *find_inheritance_children(Oid inhparent); - -extern bool has_subclass(Oid relationId); - extern bool has_unique_index(RelOptInfo *rel, AttrNumber attno); extern Selectivity restriction_selectivity(PlannerInfo *root, diff --git a/src/include/optimizer/prep.h b/src/include/optimizer/prep.h index 58b8c924618..e8dfb1e28fb 100644 --- a/src/include/optimizer/prep.h +++ b/src/include/optimizer/prep.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/optimizer/prep.h,v 1.65 2009/04/28 21:31:16 tgl Exp $ + * $PostgreSQL: pgsql/src/include/optimizer/prep.h,v 1.66 2009/05/12 00:56:05 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -46,8 +46,6 @@ extern List *preprocess_targetlist(PlannerInfo *root, List *tlist); extern Plan *plan_set_operations(PlannerInfo *root, double tuple_fraction, List **sortClauses); -extern List *find_all_inheritors(Oid parentrel); - extern void expand_inherited_tables(PlannerInfo *root); extern Node *adjust_appendrel_attrs(Node *node, AppendRelInfo *appinfo); diff --git a/src/include/parser/parse_func.h b/src/include/parser/parse_func.h index 710d703e0d5..7905f96e86c 100644 --- a/src/include/parser/parse_func.h +++ b/src/include/parser/parse_func.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/parser/parse_func.h,v 1.64 2009/01/01 17:24:00 momjian Exp $ + * $PostgreSQL: pgsql/src/include/parser/parse_func.h,v 1.65 2009/05/12 00:56:05 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -63,8 +63,6 @@ extern FuncCandidateList func_select_candidate(int nargs, Oid *input_typeids, FuncCandidateList candidates); -extern bool typeInheritsFrom(Oid subclassTypeId, Oid superclassTypeId); - extern void make_fn_arguments(ParseState *pstate, List *fargs, Oid *actual_arg_types, |
