Re: alter check constraint enforceability

jian he <jian.universality@gmail.com>

From: jian he <jian.universality@gmail.com>
To: Robert Treat <rob@xzilla.net>
Cc: Kirill Reshke <reshkekirill@gmail.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2025-12-04T06:51:54Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Add support for altering CHECK constraint enforceability

  2. rename alter constraint enforceability related functions

Attachments

On Fri, Nov 7, 2025 at 7:29 AM Robert Treat <rob@xzilla.net> wrote:
>
> > Hi!
> > I looked at v3.
> >
> > Should we rename `ATExecAlterConstrEnforceability` to
> > `ATExecAlterFKConstrEnforceability `?
> >
>
> +1
>
> Robert Treat
> https://xzilla.net

hi.

AlterConstrEnforceabilityRecurse renamed to
AlterFKConstrEnforceabilityRecurse

ATExecAlterConstrEnforceability renamed to
ATExecAlterFKConstrEnforceability.

There seem to be no tests for cases where a partitioned table’s check constraint
is not enforced, but the partition’s constraint is enforced. I’ve added tests
for this case.

ATExecAlterCheckConstrEnforceability
``rel = table_open(currcon->conrelid, NoLock);``

NoLock is ok, because parent is already locked, obviously,
``find_all_inheritors(RelationGetRelid(rel), lockmode, NULL); ``
will lock all the children with lockmode.


--
jian
https://www.enterprisedb.com