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>, "L(dot) pgsql-hackers" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andrew Dunstan <andrew(at)dunslane(dot)net>
Subject: Re: Fix bug of CHECK constraint enforceability recursion
Date: 2026-06-03 06:58:45
Message-ID: CACJufxGgSKFGWja=JPv3-zq3whON5cESLp7Z5=OsYvZOaRGnGw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jun 2, 2026 at 2:40 PM Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> wrote:
>
> Oops! I just found that I forgot to commit a tiny comment tuning in 0001. So posting v6.
>
Hi.

One partition cannot have two direct parent tables. see
ATExecAttachPartition comment:
/* A partition can only have one parent */

Also
CREATE TABLE ... PARTITION OF automatically copies the parent
constraint definition, and
ALTER TABLE ... ATTACH PARTITION already rejects cases where the
parent is enforced but the child is not.

Therefore, I think calling ATCheckCheckConstrHasEnforcedParent once is
enough for partition inheritance.

Also please check the attached minor refactoring.

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

Attachment Content-Type Size
checkconstr_inheritance_issue.nocfbot application/octet-stream 2.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Chao Li 2026-06-03 07:16:13 Fix \crosstabview to honor \pset display_true/display_false
Previous Message Fujii Masao 2026-06-03 06:55:02 Re: Reject HEADER with binary and json COPY formats by option presence