summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorAlvaro Herrera2012-04-21 02:46:20 +0000
committerAlvaro Herrera2012-04-21 02:56:57 +0000
commit09ff76fcdb275769ac4d1a45a67416735613d04b (patch)
tree15d86c29de778477258b9d43128d8ed23ced6479 /src/include
parent1f0363001166ef6a43619846e44cfb9dbe7335ed (diff)
Recast "ONLY" column CHECK constraints as NO INHERIT
The original syntax wasn't universally loved, and it didn't allow its usage in CREATE TABLE, only ALTER TABLE. It now works everywhere, and it also allows using ALTER TABLE ONLY to add an uninherited CHECK constraint, per discussion. The pg_constraint column has accordingly been renamed connoinherit. This commit partly reverts some of the changes in 61d81bd28dbec65a6b144e0cd3d0bfe25913c3ac, particularly some pg_dump and psql bits, because now pg_get_constraintdef includes the necessary NO INHERIT within the constraint definition. Author: Nikhil Sontakke Some tweaks by me
Diffstat (limited to 'src/include')
-rw-r--r--src/include/access/tupdesc.h2
-rw-r--r--src/include/catalog/catversion.h2
-rw-r--r--src/include/catalog/heap.h6
-rw-r--r--src/include/catalog/pg_constraint.h4
-rw-r--r--src/include/nodes/parsenodes.h1
5 files changed, 8 insertions, 7 deletions
diff --git a/src/include/access/tupdesc.h b/src/include/access/tupdesc.h
index 0df47a03e2..953e146d5e 100644
--- a/src/include/access/tupdesc.h
+++ b/src/include/access/tupdesc.h
@@ -30,7 +30,7 @@ typedef struct constrCheck
char *ccname;
char *ccbin; /* nodeToString representation of expr */
bool ccvalid;
- bool cconly; /* this is a non-inheritable constraint */
+ bool ccnoinherit; /* this is a non-inheritable constraint */
} ConstrCheck;
/* This structure contains constraints of a tuple */
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h
index a43491503a..88383f1e77 100644
--- a/src/include/catalog/catversion.h
+++ b/src/include/catalog/catversion.h
@@ -53,6 +53,6 @@
*/
/* yyyymmddN */
-#define CATALOG_VERSION_NO 201204141
+#define CATALOG_VERSION_NO 201204201
#endif
diff --git a/src/include/catalog/heap.h b/src/include/catalog/heap.h
index 2055382096..c0deab73ae 100644
--- a/src/include/catalog/heap.h
+++ b/src/include/catalog/heap.h
@@ -33,7 +33,8 @@ typedef struct CookedConstraint
bool skip_validation; /* skip validation? (only for CHECK) */
bool is_local; /* constraint has local (non-inherited) def */
int inhcount; /* number of times constraint is inherited */
- bool is_only; /* constraint has local def and cannot be inherited */
+ bool is_no_inherit; /* constraint has local def and cannot be
+ * inherited */
} CookedConstraint;
extern Relation heap_create(const char *relname,
@@ -92,8 +93,7 @@ extern List *AddRelationNewConstraints(Relation rel,
List *newColDefaults,
List *newConstraints,
bool allow_merge,
- bool is_local,
- bool is_only);
+ bool is_local);
extern void StoreAttrDefault(Relation rel, AttrNumber attnum, Node *expr);
diff --git a/src/include/catalog/pg_constraint.h b/src/include/catalog/pg_constraint.h
index 22d65951bd..3a77124b00 100644
--- a/src/include/catalog/pg_constraint.h
+++ b/src/include/catalog/pg_constraint.h
@@ -89,7 +89,7 @@ CATALOG(pg_constraint,2606)
int4 coninhcount;
/* Has a local definition and cannot be inherited */
- bool conisonly;
+ bool connoinherit;
#ifdef CATALOG_VARLEN /* variable-length fields start here */
/*
@@ -166,7 +166,7 @@ typedef FormData_pg_constraint *Form_pg_constraint;
#define Anum_pg_constraint_confmatchtype 13
#define Anum_pg_constraint_conislocal 14
#define Anum_pg_constraint_coninhcount 15
-#define Anum_pg_constraint_conisonly 16
+#define Anum_pg_constraint_connoinherit 16
#define Anum_pg_constraint_conkey 17
#define Anum_pg_constraint_confkey 18
#define Anum_pg_constraint_conpfeqop 19
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h
index aaa950db26..13b95e11aa 100644
--- a/src/include/nodes/parsenodes.h
+++ b/src/include/nodes/parsenodes.h
@@ -1528,6 +1528,7 @@ typedef struct Constraint
int location; /* token location, or -1 if unknown */
/* Fields used for constraints with expressions (CHECK and DEFAULT): */
+ bool is_no_inherit; /* is constraint non-inheritable? */
Node *raw_expr; /* expr, as untransformed parse tree */
char *cooked_expr; /* expr, as nodeToString representation */