From: | jian he <jian(dot)universality(at)gmail(dot)com> |
---|---|
To: | Amul Sul <sulamul(at)gmail(dot)com> |
Cc: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Peter Eisentraut <peter(at)eisentraut(dot)org>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Joel Jacobson <joel(at)compiler(dot)org> |
Subject: | Re: NOT ENFORCED constraint feature |
Date: | 2024-12-10 07:50:57 |
Message-ID: | CACJufxHMv=kzXqWHby6TxrvwR+J1SFLhCauONX1NseMDFkTRSw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
hi. some minor issue about v7-0001.
there are 5 appearances of "sizeof(CookedConstraint)"
to make it safe, it would be nice to manual do
`
cooked->is_enforced = true;
`
for other kinds of constraints.
static bool
MergeWithExistingConstraint(Relation rel, const char *ccname, Node *expr,
bool allow_merge, bool is_local,
+ bool is_enforced,
bool is_initially_valid,
bool is_no_inherit)
{
@@ -2729,12 +2738,24 @@ MergeWithExistingConstraint(Relation rel,
const char *ccname, Node *expr,
* If the child constraint is "not valid" then cannot merge with a
* valid parent constraint.
*/
- if (is_initially_valid && !con->convalidated)
+ if (is_initially_valid && con->conenforced && !con->convalidated)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("constraint \"%s\" conflicts with NOT VALID constraint on
relation \"%s\"",
ccname, RelationGetRelationName(rel))));
There are no tests for this change. I think this change is not necessary.
- a/src/test/regress/expected/alter_table.out
+++ b/src/test/regress/expected/alter_table.out
...
+ALTER TABLE attmp3 VALIDATE CONSTRAINT b_greater_than_ten_not_enforced; -- fail
+ERROR: cannot validated NOT ENFORCED constraint
there should be
ERROR: cannot validate NOT ENFORCED constraint
?
Do we need to update create_foreign_table.sgml
and alter_foreign_table.sgml?
From | Date | Subject | |
---|---|---|---|
Next Message | Kirill Reshke | 2024-12-10 09:02:56 | Re: Pass ParseState as down to utility functions. |
Previous Message | Jim Jones | 2024-12-10 07:48:27 | Re: XMLDocument (SQL/XML X030) |