Thread: pgsql: Change the rules for inherited CHECK constraints to be
pgsql: Change the rules for inherited CHECK constraints to be
From
tgl@postgresql.org (Tom Lane)
Date:
Log Message: ----------- 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 Modified Files: -------------- pgsql/doc/src/sgml: catalogs.sgml (r2.165 -> r2.166) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/catalogs.sgml?r1=2.165&r2=2.166) ddl.sgml (r1.81 -> r1.82) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/ddl.sgml?r1=1.81&r2=1.82) pgsql/doc/src/sgml/ref: alter_table.sgml (r1.98 -> r1.99) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/ref/alter_table.sgml?r1=1.98&r2=1.99) create_table.sgml (r1.109 -> r1.110) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/ref/create_table.sgml?r1=1.109&r2=1.110) pgsql/src/backend/access/common: tupdesc.c (r1.122 -> r1.123) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/common/tupdesc.c?r1=1.122&r2=1.123) pgsql/src/backend/bootstrap: bootparse.y (r1.91 -> r1.92) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/bootstrap/bootparse.y?r1=1.91&r2=1.92) pgsql/src/backend/catalog: heap.c (r1.332 -> r1.333) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/catalog/heap.c?r1=1.332&r2=1.333) index.c (r1.296 -> r1.297) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/catalog/index.c?r1=1.296&r2=1.297) pg_constraint.c (r1.40 -> r1.41) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/catalog/pg_constraint.c?r1=1.40&r2=1.41) toasting.c (r1.9 -> r1.10) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/catalog/toasting.c?r1=1.9&r2=1.10) pgsql/src/backend/commands: cluster.c (r1.173 -> r1.174) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/cluster.c?r1=1.173&r2=1.174) tablecmds.c (r1.251 -> r1.252) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/tablecmds.c?r1=1.251&r2=1.252) typecmds.c (r1.117 -> r1.118) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/typecmds.c?r1=1.117&r2=1.118) pgsql/src/backend/executor: execMain.c (r1.306 -> r1.307) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/executor/execMain.c?r1=1.306&r2=1.307) pgsql/src/bin/pg_dump: common.c (r1.103 -> r1.104) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/bin/pg_dump/common.c?r1=1.103&r2=1.104) pg_dump.c (r1.489 -> r1.490) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/bin/pg_dump/pg_dump.c?r1=1.489&r2=1.490) pg_dump.h (r1.139 -> r1.140) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/bin/pg_dump/pg_dump.h?r1=1.139&r2=1.140) pgsql/src/include/catalog: catversion.h (r1.457 -> r1.458) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/catversion.h?r1=1.457&r2=1.458) heap.h (r1.87 -> r1.88) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/heap.h?r1=1.87&r2=1.88) pg_constraint.h (r1.28 -> r1.29) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_constraint.h?r1=1.28&r2=1.29) pgsql/src/include/nodes: parsenodes.h (r1.364 -> r1.365) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/nodes/parsenodes.h?r1=1.364&r2=1.365) pgsql/src/test/regress/expected: alter_table.out (r1.105 -> r1.106) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/expected/alter_table.out?r1=1.105&r2=1.106) inherit.out (r1.23 -> r1.24) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/expected/inherit.out?r1=1.23&r2=1.24) pgsql/src/test/regress/sql: alter_table.sql (r1.57 -> r1.58) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/sql/alter_table.sql?r1=1.57&r2=1.58) inherit.sql (r1.11 -> r1.12) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/sql/inherit.sql?r1=1.11&r2=1.12)