Re: Fix bug of CHECK constraint enforceability recursion

From: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
To: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Fix bug of CHECK constraint enforceability recursion
Date: 2026-06-06 03:06:00
Message-ID: AF248D33-FFE4-480F-A543-DD31621A5AD7@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Jun 6, 2026, at 02:44, Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com> wrote:
>
>> * It is common for a partitioned table to have thousands of partitions, but I rarely hear of a regular inherited table having thousands of descendants.
>
> Yes, that's why I also wasn't sure if it's needed or not, I can
> construct scenarios where alters take a relatively long time, but
> those do not seem to be realistic at all... so maybe it's an
> acceptable limitation as you said.
>
>> BTW, do you have any comments on the doc changes in 0002 and 0003?
>
> + (check and not-null constraints) down the inheritance hierarchy. With
> + multiple inheritance, if a column or constraint is inherited from more
> + than one parent, the stricter definition applies.
>
> The documentation changes generally look good to me, but should this
> statement be part of the alter table description? There's a paragraph
> about merge rules above which might be a better fit for it.
> ("Inheritable check constraints and not-null constraints are merged in
> a similar fashion")
>

Make sense.

PFA v8: 0001 and 0003 unchanged. 0002 addressed Zsolt’s comment.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

Attachment Content-Type Size
v8-0001-Prevent-inherited-CHECK-constraints-from-being-we.patch application/octet-stream 24.7 KB
v8-0002-doc-Clarify-inherited-constraint-behavior.patch application/octet-stream 4.4 KB
v8-0003-doc-Clarify-ALTER-CONSTRAINT-enforceability-behav.patch application/octet-stream 2.3 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message ZizhuanLiu X-MAN 2026-06-06 03:30:26 Re: Adjust pg_stat_get_lock() prorows to match lock types
Previous Message Chao Li 2026-06-06 01:10:46 Re: Prevent remote libpq notices from being sent to clients