From: | Robert Treat <rob(at)xzilla(dot)net> |
---|---|
To: | jian he <jian(dot)universality(at)gmail(dot)com> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: alter check constraint enforceability |
Date: | 2025-08-06 23:35:08 |
Message-ID: | CABV9wwNF45wmhs3gFH7qcyEVQjREQL1y=2ARzLgY__fNT2tWpw@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Jul 4, 2025 at 8:00 AM jian he <jian(dot)universality(at)gmail(dot)com> wrote:
>
> On Mon, Jun 2, 2025 at 9:57 PM jian he <jian(dot)universality(at)gmail(dot)com> wrote:
> >
> > Currently in pg18, we can add not enforced check constraints.
> > but we can not do ALTER TABLE ALTER CONSTRAINT [NOT] ENFORCED
> > for check constraint.
> >
> > The attached patch is implementation of changing enforceability of
> > check constraint.
>
Initial look and testing looks good. There are some odd parts to work
through with partitioned tables and recursion (for example, if you
have a parent unenforced, and a child enforced, setting a parent
enforced and then not enforced will recurse to the child, so you end
up in a different state. that could be surprising, but the alternative
is not obviously more sensicle).
Some minor items below:
+ errhint("Only foreign key, check constraint can change enforceability"));
"Only foreign key and check constraints can change enforceability"
--
+ /*
+ * If we are told not to recurse, there had better not be any child
+ * tables, because we can't changing constraint enforceability on
+ * the parent unless we have chaned enforceability for all child
+ * tables.
+ */
* tables, because we can't change constraint enforceability on
* the parent unless we have changed enforceability for all child
--
+ if (rel->rd_rel->relkind == RELKIND_RELATION &&
+ cmdcon->is_enforced &&
+ !currcon->conenforced)
i think I have convinced myself that this is correct, but maybe I will
ask you if you had any concerns that this needed to also consider
RELKIND_PARTITIONED_TABLE as well?
Robert Treat
https://xzilla.net
From | Date | Subject | |
---|---|---|---|
Next Message | Jacob Champion | 2025-08-06 23:55:44 | Re: [PATCH] OAuth: fix performance bug with stuck multiplexer events |
Previous Message | Michael Paquier | 2025-08-06 23:18:26 | Re: BF mamba failure |