Re: Fix bug of CHECK constraint enforceability recursion - Mailing list pgsql-hackers

From jian he
Subject Re: Fix bug of CHECK constraint enforceability recursion
Date
Msg-id CACJufxEXyn_0RGBmULM4QQykSCh9wxXF-6wNnHo1pNefacPSag@mail.gmail.com
Whole thread
Responses Re: Fix bug of CHECK constraint enforceability recursion
List pgsql-hackers
On Tue, Jun 9, 2026 at 8:32 AM Chao Li <li.evan.chao@gmail.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

pgsql-hackers by date:

Previous
From: Ewan Young
Date:
Subject: Re: Fast-path FK checks reject valid inserts for domain-typed FK columns
Next
From: Peter Smith
Date:
Subject: DOCS - Clarify behaviour when EXCEPT tables are moved/renamed