mirror of
https://github.com/postgres/postgres.git
synced 2025-10-27 00:12:01 +03:00
Change the rules for inherited CHECK constraints to be essentially the same
as those for inherited columns; that is, it's no longer allowed for a child table to not have a check constraint matching one that exists on a parent. This satisfies the principle of least surprise (rows selected from the parent will always appear to meet its check constraints) and eliminates some longstanding bogosity in pg_dump, which formerly had to guess about whether check constraints were really inherited or not. The implementation involves adding conislocal and coninhcount columns to pg_constraint (paralleling attislocal and attinhcount in pg_attribute) and refactoring various ALTER TABLE actions to be more like those for columns. Alex Hunsaker, Nikhil Sontakke, Tom Lane
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/commands/cluster.c,v 1.173 2008/04/13 19:18:14 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/commands/cluster.c,v 1.174 2008/05/09 23:32:04 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -639,9 +639,12 @@ make_new_heap(Oid OIDOldHeap, const char *NewName, Oid NewTableSpace)
|
||||
|
||||
/*
|
||||
* Need to make a copy of the tuple descriptor, since
|
||||
* heap_create_with_catalog modifies it.
|
||||
* heap_create_with_catalog modifies it. Note that the NewHeap will
|
||||
* not receive any of the defaults or constraints associated with the
|
||||
* OldHeap; we don't need 'em, and there's no reason to spend cycles
|
||||
* inserting them into the catalogs only to delete them.
|
||||
*/
|
||||
tupdesc = CreateTupleDescCopyConstr(OldHeapDesc);
|
||||
tupdesc = CreateTupleDescCopy(OldHeapDesc);
|
||||
|
||||
/*
|
||||
* Use options of the old heap for new heap.
|
||||
@@ -662,6 +665,7 @@ make_new_heap(Oid OIDOldHeap, const char *NewName, Oid NewTableSpace)
|
||||
InvalidOid,
|
||||
OldHeap->rd_rel->relowner,
|
||||
tupdesc,
|
||||
NIL,
|
||||
OldHeap->rd_rel->relkind,
|
||||
OldHeap->rd_rel->relisshared,
|
||||
true,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.117 2008/03/27 03:57:33 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.118 2008/05/09 23:32:04 tgl Exp $
|
||||
*
|
||||
* DESCRIPTION
|
||||
* The "DefineFoo" routines take the parse tree and pick out the
|
||||
@@ -2206,7 +2206,9 @@ domainAddConstraint(Oid domainOid, Oid domainNamespace, Oid baseTypeOid,
|
||||
InvalidOid,
|
||||
expr, /* Tree form check constraint */
|
||||
ccbin, /* Binary form check constraint */
|
||||
ccsrc); /* Source form check constraint */
|
||||
ccsrc, /* Source form check constraint */
|
||||
true, /* is local */
|
||||
0); /* inhcount */
|
||||
|
||||
/*
|
||||
* Return the compiled constraint expression so the calling routine can
|
||||
|
||||
Reference in New Issue
Block a user