Re: Fix bug of CHECK constraint enforceability recursion

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Cc: Álvaro Herrera <alvherre(at)kurilemu(dot)de>, Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Fix bug of CHECK constraint enforceability recursion
Date: 2026-06-17 03:27:31
Message-ID: CACJufxEXyn_0RGBmULM4QQykSCh9wxXF-6wNnHo1pNefacPSag@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jun 9, 2026 at 8:32 AM Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> wrote:
>
> In v10, I split the “because” part to a errdetail, also moved out NOT ENFORCED out of the translate message.
>

ATCheckCheckConstrHasEnforcedParent
``````
if (constraints_equivalent(parenttup, contuple,
RelationGetDescr(conrel)))
{
``````
The above IF condition is basically always true (see
MergeConstraintsIntoExisting), unless an inherited check constraint
has a
different definition, which should not happen.
So I did a quick refactor here, which also drops the nesting level down by one.

Other than that, v10 looks good to me.

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

Attachment Content-Type Size
v10-0001-misc-refactor-ATCheckCheckConstrHasEnforcedParent.nocfbot application/octet-stream 3.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Smith 2026-06-17 03:33:55 DOCS - Clarify behaviour when EXCEPT tables are moved/renamed
Previous Message Ewan Young 2026-06-17 02:27:57 Re: Fast-path FK checks reject valid inserts for domain-typed FK columns