]> granicus.if.org Git - postgresql/commitdiff
Move pg_constraint.h function declarations to new file pg_constraint_fn.h.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 11 Feb 2016 20:51:28 +0000 (15:51 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 11 Feb 2016 20:51:28 +0000 (15:51 -0500)
A pending patch requires exporting a function returning Bitmapset from
catalog/pg_constraint.c.  As things stand, that would mean including
nodes/bitmapset.h in pg_constraint.h, which might be hazardous for the
client-side includability of that header.  It's not entirely clear whether
any client-side code needs to include pg_constraint.h, but it seems prudent
to assume that there is some such code somewhere.  Therefore, split off the
function definitions into a new file pg_constraint_fn.h, similarly to what
we've done for some other catalog header files.

13 files changed:
src/backend/catalog/dependency.c
src/backend/catalog/heap.c
src/backend/catalog/index.c
src/backend/catalog/objectaddress.c
src/backend/catalog/pg_constraint.c
src/backend/commands/tablecmds.c
src/backend/commands/trigger.c
src/backend/commands/typecmds.c
src/backend/parser/parse_agg.c
src/backend/parser/parse_clause.c
src/backend/parser/parse_utilcmd.c
src/include/catalog/pg_constraint.h
src/include/catalog/pg_constraint_fn.h [new file with mode: 0644]

index d657c20bad1142bbe5fe8834a92f6c90838c3d41..c48e37bf9a2424f892e1ddee71677ec66558ff29 100644 (file)
@@ -28,6 +28,7 @@
 #include "catalog/pg_collation.h"
 #include "catalog/pg_collation_fn.h"
 #include "catalog/pg_constraint.h"
+#include "catalog/pg_constraint_fn.h"
 #include "catalog/pg_conversion.h"
 #include "catalog/pg_conversion_fn.h"
 #include "catalog/pg_database.h"
index d14cbb7ab909fbf629978f418d38715160fee356..6a4a9d9302b4937f7feb50d50b1baaad5faab522 100644 (file)
@@ -44,6 +44,7 @@
 #include "catalog/pg_attrdef.h"
 #include "catalog/pg_collation.h"
 #include "catalog/pg_constraint.h"
+#include "catalog/pg_constraint_fn.h"
 #include "catalog/pg_foreign_table.h"
 #include "catalog/pg_inherits.h"
 #include "catalog/pg_namespace.h"
index 313ee9c4edce162cc73367b45617e7c33c55a539..a309c446e37bb558f18ca73e6303cc607c7ddaca 100644 (file)
@@ -40,6 +40,7 @@
 #include "catalog/pg_am.h"
 #include "catalog/pg_collation.h"
 #include "catalog/pg_constraint.h"
+#include "catalog/pg_constraint_fn.h"
 #include "catalog/pg_operator.h"
 #include "catalog/pg_opclass.h"
 #include "catalog/pg_tablespace.h"
index 0232e0d8678907ea7e178bd3fa8f0830d5679e2b..d2aaa6ded92e6e2231d290c6a75884b1fe9cf3aa 100644 (file)
@@ -30,6 +30,7 @@
 #include "catalog/pg_event_trigger.h"
 #include "catalog/pg_collation.h"
 #include "catalog/pg_constraint.h"
+#include "catalog/pg_constraint_fn.h"
 #include "catalog/pg_conversion.h"
 #include "catalog/pg_database.h"
 #include "catalog/pg_extension.h"
index 28e3aed246936984f98b0029ebf1a7cab9c695a8..d85484976a910feca3106e982483ccc2f592863b 100644 (file)
@@ -21,6 +21,7 @@
 #include "catalog/indexing.h"
 #include "catalog/objectaccess.h"
 #include "catalog/pg_constraint.h"
+#include "catalog/pg_constraint_fn.h"
 #include "catalog/pg_operator.h"
 #include "catalog/pg_type.h"
 #include "commands/defrem.h"
index eeda3b4697b137be8f31397d103356d62081ea0f..96dc923bcdf493b3eca87218801bd411df54d872 100644 (file)
@@ -32,6 +32,7 @@
 #include "catalog/pg_am.h"
 #include "catalog/pg_collation.h"
 #include "catalog/pg_constraint.h"
+#include "catalog/pg_constraint_fn.h"
 #include "catalog/pg_depend.h"
 #include "catalog/pg_foreign_table.h"
 #include "catalog/pg_inherits.h"
index 15cb18b012306400b047b2a4b813535418fb599f..cca2e43b100b3833312b9eac596e9e334f5431bc 100644 (file)
@@ -23,6 +23,7 @@
 #include "catalog/indexing.h"
 #include "catalog/objectaccess.h"
 #include "catalog/pg_constraint.h"
+#include "catalog/pg_constraint_fn.h"
 #include "catalog/pg_proc.h"
 #include "catalog/pg_trigger.h"
 #include "catalog/pg_type.h"
index 4f41766eef5d3d751a5e2de5a25fe1e12d7e1937..227d382a38c2847e38fc55fdb4315e6c8416cbad 100644 (file)
@@ -41,6 +41,7 @@
 #include "catalog/pg_authid.h"
 #include "catalog/pg_collation.h"
 #include "catalog/pg_constraint.h"
+#include "catalog/pg_constraint_fn.h"
 #include "catalog/pg_depend.h"
 #include "catalog/pg_enum.h"
 #include "catalog/pg_language.h"
index b790bb27c5dcd398ad981ce1de3070cbb9bc30ef..b109ea5ba69841f0e0174e24dfa133882cf6042e 100644 (file)
@@ -15,7 +15,7 @@
 #include "postgres.h"
 
 #include "catalog/pg_aggregate.h"
-#include "catalog/pg_constraint.h"
+#include "catalog/pg_constraint_fn.h"
 #include "catalog/pg_type.h"
 #include "nodes/makefuncs.h"
 #include "nodes/nodeFuncs.h"
index 7ea455cf043db4e6d944c869831a8505e0aa5dcd..04fa1271c806cb68608444043f44c16500f7fa75 100644 (file)
@@ -22,7 +22,7 @@
 #include "catalog/catalog.h"
 #include "catalog/heap.h"
 #include "catalog/pg_am.h"
-#include "catalog/pg_constraint.h"
+#include "catalog/pg_constraint_fn.h"
 #include "catalog/pg_type.h"
 #include "commands/defrem.h"
 #include "nodes/makefuncs.h"
index a65b2977281908cd4f4c845463a177f6177503a3..dc431c7de0c4581019986ba555852728e313bbde 100644 (file)
@@ -36,6 +36,7 @@
 #include "catalog/pg_am.h"
 #include "catalog/pg_collation.h"
 #include "catalog/pg_constraint.h"
+#include "catalog/pg_constraint_fn.h"
 #include "catalog/pg_opclass.h"
 #include "catalog/pg_operator.h"
 #include "catalog/pg_type.h"
index 07dbceac3fc598551e103f5c7097238248b3c2f3..666b2304bf8b2a27653ad786a39cf09edb1d06ca 100644 (file)
@@ -20,8 +20,6 @@
 #define PG_CONSTRAINT_H
 
 #include "catalog/genbki.h"
-#include "catalog/dependency.h"
-#include "nodes/pg_list.h"
 
 /* ----------------
  *             pg_constraint definition.  cpp turns this into
@@ -178,6 +176,13 @@ typedef FormData_pg_constraint *Form_pg_constraint;
 #define Anum_pg_constraint_conbin                      23
 #define Anum_pg_constraint_consrc                      24
 
+/* ----------------
+ *             initial contents of pg_constraint
+ * ----------------
+ */
+
+/* nothing, at present */
+
 
 /* Valid values for contype */
 #define CONSTRAINT_CHECK                       'c'
@@ -193,66 +198,4 @@ typedef FormData_pg_constraint *Form_pg_constraint;
  * the FKCONSTR_MATCH_xxx constants defined in parsenodes.h.
  */
 
-/*
- * Identify constraint type for lookup purposes
- */
-typedef enum ConstraintCategory
-{
-       CONSTRAINT_RELATION,
-       CONSTRAINT_DOMAIN,
-       CONSTRAINT_ASSERTION            /* for future expansion */
-} ConstraintCategory;
-
-/*
- * prototypes for functions in pg_constraint.c
- */
-extern Oid CreateConstraintEntry(const char *constraintName,
-                                         Oid constraintNamespace,
-                                         char constraintType,
-                                         bool isDeferrable,
-                                         bool isDeferred,
-                                         bool isValidated,
-                                         Oid relId,
-                                         const int16 *constraintKey,
-                                         int constraintNKeys,
-                                         Oid domainId,
-                                         Oid indexRelId,
-                                         Oid foreignRelId,
-                                         const int16 *foreignKey,
-                                         const Oid *pfEqOp,
-                                         const Oid *ppEqOp,
-                                         const Oid *ffEqOp,
-                                         int foreignNKeys,
-                                         char foreignUpdateType,
-                                         char foreignDeleteType,
-                                         char foreignMatchType,
-                                         const Oid *exclOp,
-                                         Node *conExpr,
-                                         const char *conBin,
-                                         const char *conSrc,
-                                         bool conIsLocal,
-                                         int conInhCount,
-                                         bool conNoInherit,
-                                         bool is_internal);
-
-extern void RemoveConstraintById(Oid conId);
-extern void RenameConstraintById(Oid conId, const char *newname);
-extern void SetValidatedConstraintById(Oid conId);
-
-extern bool ConstraintNameIsUsed(ConstraintCategory conCat, Oid objId,
-                                        Oid objNamespace, const char *conname);
-extern char *ChooseConstraintName(const char *name1, const char *name2,
-                                        const char *label, Oid namespaceid,
-                                        List *others);
-
-extern void AlterConstraintNamespaces(Oid ownerId, Oid oldNspId,
-                                         Oid newNspId, bool isType, ObjectAddresses *objsMoved);
-extern Oid     get_relation_constraint_oid(Oid relid, const char *conname, bool missing_ok);
-extern Oid     get_domain_constraint_oid(Oid typid, const char *conname, bool missing_ok);
-
-extern bool check_functional_grouping(Oid relid,
-                                                 Index varno, Index varlevelsup,
-                                                 List *grouping_columns,
-                                                 List **constraintDeps);
-
 #endif   /* PG_CONSTRAINT_H */
diff --git a/src/include/catalog/pg_constraint_fn.h b/src/include/catalog/pg_constraint_fn.h
new file mode 100644 (file)
index 0000000..ccd6dff
--- /dev/null
@@ -0,0 +1,79 @@
+/*-------------------------------------------------------------------------
+ *
+ * pg_constraint_fn.h
+ *      prototypes for functions in catalog/pg_constraint.c
+ *
+ *
+ * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/catalog/pg_constraint_fn.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef PG_CONSTRAINT_FN_H
+#define PG_CONSTRAINT_FN_H
+
+#include "catalog/dependency.h"
+#include "nodes/pg_list.h"
+
+/*
+ * Identify constraint type for lookup purposes
+ */
+typedef enum ConstraintCategory
+{
+       CONSTRAINT_RELATION,
+       CONSTRAINT_DOMAIN,
+       CONSTRAINT_ASSERTION            /* for future expansion */
+} ConstraintCategory;
+
+extern Oid CreateConstraintEntry(const char *constraintName,
+                                         Oid constraintNamespace,
+                                         char constraintType,
+                                         bool isDeferrable,
+                                         bool isDeferred,
+                                         bool isValidated,
+                                         Oid relId,
+                                         const int16 *constraintKey,
+                                         int constraintNKeys,
+                                         Oid domainId,
+                                         Oid indexRelId,
+                                         Oid foreignRelId,
+                                         const int16 *foreignKey,
+                                         const Oid *pfEqOp,
+                                         const Oid *ppEqOp,
+                                         const Oid *ffEqOp,
+                                         int foreignNKeys,
+                                         char foreignUpdateType,
+                                         char foreignDeleteType,
+                                         char foreignMatchType,
+                                         const Oid *exclOp,
+                                         Node *conExpr,
+                                         const char *conBin,
+                                         const char *conSrc,
+                                         bool conIsLocal,
+                                         int conInhCount,
+                                         bool conNoInherit,
+                                         bool is_internal);
+
+extern void RemoveConstraintById(Oid conId);
+extern void RenameConstraintById(Oid conId, const char *newname);
+extern void SetValidatedConstraintById(Oid conId);
+
+extern bool ConstraintNameIsUsed(ConstraintCategory conCat, Oid objId,
+                                        Oid objNamespace, const char *conname);
+extern char *ChooseConstraintName(const char *name1, const char *name2,
+                                        const char *label, Oid namespaceid,
+                                        List *others);
+
+extern void AlterConstraintNamespaces(Oid ownerId, Oid oldNspId,
+                                         Oid newNspId, bool isType, ObjectAddresses *objsMoved);
+extern Oid     get_relation_constraint_oid(Oid relid, const char *conname, bool missing_ok);
+extern Oid     get_domain_constraint_oid(Oid typid, const char *conname, bool missing_ok);
+
+extern bool check_functional_grouping(Oid relid,
+                                                 Index varno, Index varlevelsup,
+                                                 List *grouping_columns,
+                                                 List **constraintDeps);
+
+#endif   /* PG_CONSTRAINT_FN_H */