pgsql: Add support for altering CHECK constraint enforceability
pgsql: Add support for altering CHECK constraint enforceability
От:
Andrew Dunstan <andrew@dunslane.net>
Дата:
Add support for altering CHECK constraint enforceability This commit adds support for ALTER TABLE ALTER CONSTRAINT ... [NOT] ENFORCED for CHECK constraints. Previously, only foreign key constraints could have their enforceability altered. When changing from NOT ENFORCED to ENFORCED, the operation not only updates catalog information but also performs a full table scan in Phase 3 to validate that existing data satisfies the constraint. For partitioned tables and inheritance hierarchies, the operation recurses to all child tables. When changing to NOT ENFORCED, we must recurse even if the parent is already NOT ENFORCED, since child constraints may still be ENFORCED. Author: Jian He Reviewed-by: Robert Treat Reviewed-by: Kirill Reshke Reviewed-by: Amul Sul Reviewed-by: Zsolt Parragi Reviewed-by: Andrew Dunstan Discussion: https://postgr.es/m/CACJufxHCh_FU-FsEwsCvg9mN6-5tzR6H9ntn+0KUgTCaerDOmg@mail.gmail.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/342051d73b386ad763e13930e15031f7ba5367f5 Modified Files -------------- doc/src/sgml/ref/alter_table.sgml | 4 +- src/backend/commands/tablecmds.c | 194 ++++++++++++++++++++++++++++-- src/test/regress/expected/constraints.out | 80 ++++++++++++ src/test/regress/expected/inherit.out | 62 ++++++++++ src/test/regress/sql/constraints.sql | 52 ++++++++ src/test/regress/sql/inherit.sql | 43 +++++++ 6 files changed, 423 insertions(+), 12 deletions(-)