diff options
| author | Alvaro Herrera | 2024-05-13 09:31:09 +0000 |
|---|---|---|
| committer | Alvaro Herrera | 2024-05-13 09:31:09 +0000 |
| commit | 6f8bb7c1e9610dd7af20cdaf74c4ff6e6d678d44 (patch) | |
| tree | d490c49cc914cc625dbbf8d17e1975dabb15e7e5 /src/include | |
| parent | e89f4c66182e409b6643b1e8426371011dc25217 (diff) | |
Revert structural changes to not-null constraints
There are some problems with the new way to handle these constraints
that were detected at the last minute, and require fixes that appear too
invasive to be doing this late in the cycle. Revert this (again) for
now, we'll try again with these problems fixed.
The following commits are reverted:
b0e96f311985 Catalog not-null constraints
9b581c534186 Disallow changing NO INHERIT status of a not-null constraint
d0ec2ddbe088 Fix not-null constraint test
ac22a9545ca9 Move privilege check to the right place
b0f7dd915bca Check stack depth in new recursive functions
3af721794272 Update information_schema definition for not-null constraints
c3709100be73 Fix propagating attnotnull in multiple inheritance
d9f686a72ee9 Fix restore of not-null constraints with inheritance
d72d32f52d26 Don't try to assign smart names to constraints
0cd711271d42 Better handle indirect constraint drops
13daa33fa5a6 Disallow NO INHERIT not-null constraints on partitioned tables
d45597f72fe5 Disallow direct change of NO INHERIT of not-null constraints
21ac38f498b3 Fix inconsistencies in error messages
Discussion: https://postgr.es/m/202405110940.joxlqcx4dogd@alvherre.pgsql
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/catalog/catversion.h | 2 | ||||
| -rw-r--r-- | src/include/catalog/heap.h | 8 | ||||
| -rw-r--r-- | src/include/catalog/pg_constraint.h | 7 | ||||
| -rw-r--r-- | src/include/nodes/parsenodes.h | 11 |
4 files changed, 8 insertions, 20 deletions
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index 8793a12a4d7..4fb60873772 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -57,6 +57,6 @@ */ /* yyyymmddN */ -#define CATALOG_VERSION_NO 202405061 +#define CATALOG_VERSION_NO 202405131 #endif diff --git a/src/include/catalog/heap.h b/src/include/catalog/heap.h index e446d49b3ea..c512824cd1c 100644 --- a/src/include/catalog/heap.h +++ b/src/include/catalog/heap.h @@ -34,11 +34,10 @@ typedef struct RawColumnDefault typedef struct CookedConstraint { - ConstrType contype; /* CONSTR_DEFAULT, CONSTR_CHECK, - * CONSTR_NOTNULL */ + ConstrType contype; /* CONSTR_DEFAULT or CONSTR_CHECK */ Oid conoid; /* constr OID if created, otherwise Invalid */ char *name; /* name, or NULL if none */ - AttrNumber attnum; /* which attr (only for NOTNULL, DEFAULT) */ + AttrNumber attnum; /* which attr (only for DEFAULT) */ Node *expr; /* transformed default or check expr */ bool skip_validation; /* skip validation? (only for CHECK) */ bool is_local; /* constraint has local (non-inherited) def */ @@ -114,9 +113,6 @@ extern List *AddRelationNewConstraints(Relation rel, bool is_local, bool is_internal, const char *queryString); -extern List *AddRelationNotNullConstraints(Relation rel, - List *constraints, - List *old_notnulls); extern void RelationClearMissing(Relation rel); extern void SetAttrMissing(Oid relid, char *attname, char *value); diff --git a/src/include/catalog/pg_constraint.h b/src/include/catalog/pg_constraint.h index 68bf55fdf70..115217a6162 100644 --- a/src/include/catalog/pg_constraint.h +++ b/src/include/catalog/pg_constraint.h @@ -257,14 +257,7 @@ extern char *ChooseConstraintName(const char *name1, const char *name2, const char *label, Oid namespaceid, List *others); -extern HeapTuple findNotNullConstraintAttnum(Oid relid, AttrNumber attnum); -extern HeapTuple findNotNullConstraint(Oid relid, const char *colname); extern HeapTuple findDomainNotNullConstraint(Oid typid); -extern AttrNumber extractNotNullColumn(HeapTuple constrTup); -extern int AdjustNotNullInheritance1(Oid relid, AttrNumber attnum, int count, - bool is_no_inherit, bool allow_noinherit_change); -extern void AdjustNotNullInheritance(Oid relid, Bitmapset *columns, int count); -extern List *RelationGetNotNullConstraints(Oid relid, bool cooked); extern void RemoveConstraintById(Oid conId); extern void RenameConstraintById(Oid conId, const char *newname); diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h index 3ca06fc3af6..dcfd080dd5c 100644 --- a/src/include/nodes/parsenodes.h +++ b/src/include/nodes/parsenodes.h @@ -2356,9 +2356,9 @@ typedef enum AlterTableType AT_CookedColumnDefault, /* add a pre-cooked column default */ AT_DropNotNull, /* alter column drop not null */ AT_SetNotNull, /* alter column set not null */ - AT_SetAttNotNull, /* set attnotnull w/o a constraint */ AT_SetExpression, /* alter column set expression */ AT_DropExpression, /* alter column drop expression */ + AT_CheckNotNull, /* check column is already marked not null */ AT_SetStatistics, /* alter column set statistics */ AT_SetOptions, /* alter column set ( options ) */ AT_ResetOptions, /* alter column reset ( options ) */ @@ -2643,10 +2643,10 @@ typedef struct VariableShowStmt * Create Table Statement * * NOTE: in the raw gram.y output, ColumnDef and Constraint nodes are - * intermixed in tableElts, and constraints and nnconstraints are NIL. After - * parse analysis, tableElts contains just ColumnDefs, nnconstraints contains - * Constraint nodes of CONSTR_NOTNULL type from various sources, and - * constraints contains just CONSTR_CHECK Constraint nodes. + * intermixed in tableElts, and constraints is NIL. After parse analysis, + * tableElts contains just ColumnDefs, and constraints contains just + * Constraint nodes (in fact, only CONSTR_CHECK nodes, in the present + * implementation). * ---------------------- */ @@ -2661,7 +2661,6 @@ typedef struct CreateStmt PartitionSpec *partspec; /* PARTITION BY clause */ TypeName *ofTypename; /* OF typename */ List *constraints; /* constraints (list of Constraint nodes) */ - List *nnconstraints; /* NOT NULL constraints (ditto) */ List *options; /* options from WITH clause */ OnCommitAction oncommit; /* what do we do at COMMIT? */ char *tablespacename; /* table space to use, or NULL */ |
