From cd902b331dc4b0c170e800441a98f9213d98b46b Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 9 May 2008 23:32:05 +0000 Subject: 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 --- src/backend/executor/execMain.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/backend/executor/execMain.c') diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c index 8b14c04b56d..048542b99b9 100644 --- a/src/backend/executor/execMain.c +++ b/src/backend/executor/execMain.c @@ -26,7 +26,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.306 2008/04/21 03:49:45 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.307 2008/05/09 23:32:04 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -2626,7 +2626,7 @@ OpenIntoRel(QueryDesc *queryDesc) false); (void) heap_reloptions(RELKIND_RELATION, reloptions, true); - /* have to copy the actual tupdesc to get rid of any constraints */ + /* Copy the tupdesc because heap_create_with_catalog modifies it */ tupdesc = CreateTupleDescCopy(queryDesc->tupDesc); /* Now we can actually create the new relation */ @@ -2636,6 +2636,7 @@ OpenIntoRel(QueryDesc *queryDesc) InvalidOid, GetUserId(), tupdesc, + NIL, RELKIND_RELATION, false, true, -- cgit v1.2.3