public inbox for [email protected]  
help / color / mirror / Atom feed
From: jian he <[email protected]>
To: Chao Li <[email protected]>
Cc: Álvaro Herrera <[email protected]>
Cc: L. pgsql-hackers <[email protected]>
Cc: Andrew Dunstan <[email protected]>
Subject: Re: Fix bug of CHECK constraint enforceability recursion
Date: Wed, 3 Jun 2026 14:58:45 +0800
Message-ID: <CACJufxGgSKFGWja=JPv3-zq3whON5cESLp7Z5=OsYvZOaRGnGw@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[email protected]>
	<CACJufxHbVuY683j3DHEU4LSswo8DTzLJbTvhv2Uj6gqN8pJs7Q@mail.gmail.com>
	<[email protected]>
	<[email protected]>

On Tue, Jun 2, 2026 at 2:40 PM Chao Li <[email protected]> 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/


Attachments:

  [application/octet-stream] checkconstr_inheritance_issue.nocfbot (2.2K, 2-checkconstr_inheritance_issue.nocfbot)
  download

view thread (32+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Fix bug of CHECK constraint enforceability recursion
  In-Reply-To: <CACJufxGgSKFGWja=JPv3-zq3whON5cESLp7Z5=OsYvZOaRGnGw@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox