(trimmed cc's)
Find attached inherited_constraint_v2.patch
Changes since v1:
-rebased against latest HEAD
-changed enum { Anum_pg_constraint_... } back into #define
Anum_pg_constraint_...
-remove whitespace damage I added
-fixed regression tests I added to be more robust
-fixed
create table ac (a int constraint check_a check (a <> 0));
create table bc (a int constraint check_a check (a <> 0)) inherits (ac);
so it properly works (removed crud I put into
AddRelationRawConstraints and created a proper fix in DefineRelation)
diffstat to head:
src/backend/catalog/heap.c | 15 +-
src/backend/catalog/index.c | 4 +-
src/backend/catalog/pg_constraint.c | 7 +-
src/backend/commands/tablecmds.c | 488 ++++++++++++++++++++++-------
src/backend/commands/typecmds.c | 4 +-
src/backend/nodes/copyfuncs.c | 2 +
src/backend/nodes/equalfuncs.c | 2 +
src/backend/nodes/outfuncs.c | 3 +
src/backend/parser/gram.y | 4 +
src/backend/parser/parse_utilcmd.c | 5 +
src/backend/utils/cache/catcache.c | 2 +-
src/backend/utils/cache/syscache.c | 12 +
src/include/access/tupdesc.h | 6 +-
src/include/catalog/catversion.h | 2 +-
src/include/catalog/indexing.h | 2 +
src/include/catalog/pg_constraint.h | 51 ++--
src/include/nodes/parsenodes.h | 4 +-
src/include/utils/syscache.h | 99 +++---
src/test/regress/expected/alter_table.out | 2 +-
src/test/regress/expected/inherit.out | 76 +++++
src/test/regress/sql/inherit.sql | 38 +++
21 files changed, 637 insertions(+), 191 deletions(-)