mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
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
This commit is contained in:
@@ -1304,9 +1304,20 @@ get_relation_constraints(PlannerInfo *root,
|
||||
*/
|
||||
if (!constr->check[i].ccvalid)
|
||||
continue;
|
||||
|
||||
/*
|
||||
* NOT ENFORCED constraints are always marked as invalid, which
|
||||
* should have been ignored.
|
||||
*/
|
||||
Assert(constr->check[i].ccenforced);
|
||||
|
||||
/*
|
||||
* Also ignore if NO INHERIT and we weren't told that that's safe.
|
||||
*/
|
||||
if (constr->check[i].ccnoinherit && !include_noinherit)
|
||||
continue;
|
||||
|
||||
|
||||
cexpr = stringToNode(constr->check[i].ccbin);
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user