Add support for NOT ENFORCED in CHECK constraintsmaster
commitca87c415e2fccf81cec6fd45698dde9fae0ab570
authorPeter Eisentraut <peter@eisentraut.org>
Sat, 11 Jan 2025 09:45:17 +0000 (11 10:45 +0100)
committerPeter Eisentraut <peter@eisentraut.org>
Sat, 11 Jan 2025 09:52:30 +0000 (11 10:52 +0100)
treef9e1f5fc7637f0baf91566f4d8a333ddb60960b1
parent72ceb21b029433dd82f29182894dce63e639b4d4
Add support for NOT ENFORCED in CHECK constraints

This adds support for the NOT ENFORCED/ENFORCED flag for constraints,
with support for check constraints.

The plan is to eventually support this for foreign key constraints,
where it is typically more useful.

Note that CHECK constraints do not currently support ALTER operations,
so changing the enforceability of an existing constraint isn't
possible without dropping and recreating it.  This could be added
later.

Author: Amul Sul <amul.sul@enterprisedb.com>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: jian he <jian.universality@gmail.com>
Tested-by: Triveni N <triveni.n@enterprisedb.com>
Discussion: https://www.postgresql.org/message-id/flat/CAAJ_b962c5AcYW9KUt_R_ER5qs3fUGbe4az-SP-vuwPS-w-AGA@mail.gmail.com
37 files changed:
doc/src/sgml/catalogs.sgml
doc/src/sgml/information_schema.sgml
doc/src/sgml/ref/alter_table.sgml
doc/src/sgml/ref/create_foreign_table.sgml
doc/src/sgml/ref/create_table.sgml
src/backend/access/common/tupdesc.c
src/backend/catalog/heap.c
src/backend/catalog/index.c
src/backend/catalog/information_schema.sql
src/backend/catalog/pg_constraint.c
src/backend/catalog/sql_features.txt
src/backend/commands/tablecmds.c
src/backend/commands/trigger.c
src/backend/commands/typecmds.c
src/backend/executor/execMain.c
src/backend/nodes/makefuncs.c
src/backend/optimizer/util/plancat.c
src/backend/parser/gram.y
src/backend/parser/parse_utilcmd.c
src/backend/utils/adt/ruleutils.c
src/backend/utils/cache/relcache.c
src/include/access/tupdesc.h
src/include/catalog/catversion.h
src/include/catalog/heap.h
src/include/catalog/pg_constraint.h
src/include/nodes/parsenodes.h
src/include/parser/kwlist.h
src/test/regress/expected/alter_table.out
src/test/regress/expected/constraints.out
src/test/regress/expected/create_table_like.out
src/test/regress/expected/domain.out
src/test/regress/expected/inherit.out
src/test/regress/sql/alter_table.sql
src/test/regress/sql/constraints.sql
src/test/regress/sql/create_table_like.sql
src/test/regress/sql/domain.sql
src/test/regress/sql/inherit.sql