]> granicus.if.org Git - postgresql/blobdiff - src/include/catalog/pg_constraint.h
CREATE INDEX ... INCLUDING (column[, ...])
[postgresql] / src / include / catalog / pg_constraint.h
index 1f01637b2e73ca8ea65f5390e70a90f6ed8fd4ed..bff2fd175b6a5d0510ea8767e78b72c6327ceebd 100644 (file)
@@ -5,7 +5,7 @@
  *       along with the relation's initial contents.
  *
  *
- * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * src/include/catalog/pg_constraint.h
@@ -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
@@ -38,7 +36,7 @@ CATALOG(pg_constraint,2606)
         * relations.  This is partly for backwards compatibility with past
         * Postgres practice, and partly because we don't want to have to obtain a
         * global lock to generate a globally unique name for a nameless
-        * constraint.  We associate a namespace with constraint names only for
+        * constraint.  We associate a namespace with constraint names only for
         * SQL-spec compatibility.
         */
        NameData        conname;                /* name of this constraint */
@@ -57,7 +55,7 @@ CATALOG(pg_constraint,2606)
 
        /*
         * contypid links to the pg_type row for a domain if this is a domain
-        * constraint.  Otherwise it's 0.
+        * constraint.  Otherwise it's 0.
         *
         * For SQL-style global ASSERTIONs, both conrelid and contypid would be
         * zero. This is not presently supported, however.
@@ -76,7 +74,7 @@ CATALOG(pg_constraint,2606)
 
        /*
         * These fields, plus confkey, are only meaningful for a foreign-key
-        * constraint.  Otherwise confrelid is 0 and the char fields are spaces.
+        * constraint.  Otherwise confrelid is 0 and the char fields are spaces.
         */
        Oid                     confrelid;              /* relation referenced by foreign key */
        char            confupdtype;    /* foreign key's ON UPDATE action */
@@ -100,6 +98,12 @@ CATALOG(pg_constraint,2606)
         */
        int16           conkey[1];
 
+       /*
+        * Columns of conrelid that the constraint does not apply to,
+        * but included into the same index with key columns.
+        */
+       int16           conincluding[1];
+
        /*
         * If a foreign key, the referenced columns of confrelid
         */
@@ -152,7 +156,7 @@ typedef FormData_pg_constraint *Form_pg_constraint;
  *             compiler constants for pg_constraint
  * ----------------
  */
-#define Natts_pg_constraint                                    24
+#define Natts_pg_constraint                                    25
 #define Anum_pg_constraint_conname                     1
 #define Anum_pg_constraint_connamespace                2
 #define Anum_pg_constraint_contype                     3
@@ -170,13 +174,21 @@ typedef FormData_pg_constraint *Form_pg_constraint;
 #define Anum_pg_constraint_coninhcount         15
 #define Anum_pg_constraint_connoinherit                16
 #define Anum_pg_constraint_conkey                      17
-#define Anum_pg_constraint_confkey                     18
-#define Anum_pg_constraint_conpfeqop           19
-#define Anum_pg_constraint_conppeqop           20
-#define Anum_pg_constraint_conffeqop           21
-#define Anum_pg_constraint_conexclop           22
-#define Anum_pg_constraint_conbin                      23
-#define Anum_pg_constraint_consrc                      24
+#define Anum_pg_constraint_conincluding                18
+#define Anum_pg_constraint_confkey                     19
+#define Anum_pg_constraint_conpfeqop           20
+#define Anum_pg_constraint_conppeqop           21
+#define Anum_pg_constraint_conffeqop           22
+#define Anum_pg_constraint_conexclop           23
+#define Anum_pg_constraint_conbin                      24
+#define Anum_pg_constraint_consrc                      25
+
+/* ----------------
+ *             initial contents of pg_constraint
+ * ----------------
+ */
+
+/* nothing, at present */
 
 
 /* Valid values for contype */
@@ -193,67 +205,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 void get_constraint_relation_oids(Oid constraint_oid, Oid *conrelid, Oid *confrelid);
-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 */