Re: Fix bug of CHECK constraint enforceability recursion

From: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Fix bug of CHECK constraint enforceability recursion
Date: 2026-06-04 19:08:02
Message-ID: CAN4CZFNjnR-7hPBO=v=9h4CdDogUueYoPqpPvR9k3X5Z9-=+TA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

The new version looks correct, I don't see any logic problem with it,
however, I do have a performance question:

+ /*
+ * A parent listed in changing_conids is being changed by the
+ * same ALTER, but it may not have been updated yet. For
+ * regular inheritance, recurse upward to check whether an
+ * equivalent enforced parent outside the ALTER will make it
+ * remain enforced. Partitions cannot have multiple parents,
+ * so they do not need this check.
+ */
+ if (!rel->rd_rel->relispartition &&
+ list_member_oid(changing_conids, parentcon->oid))

Shouldn't the parent lookup use some form of caching? Otherwise we'll
end up reevaluating the same parents multiple times. I'm not sure if
it is needed or not, how much of a performance impact this can have in
a real-world server.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ethan Mertz 2026-06-04 20:07:00 Re: Skip prefetch for block references that follow a FPW or WILL_INIT of the same block
Previous Message Andres Freund 2026-06-04 19:03:39 Re: Heads Up: cirrus-ci is shutting down June 1st