Re: BUG #19817: CREATE UNIQUE INDEX on a partitioned table can silently attach an invalid, not-ready child index, le

From: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
To: shihao zhong <zhong950419(at)gmail(dot)com>
Cc: Kirill Reshke <reshkekirill(at)gmail(dot)com>, 303677365(at)qq(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19817: CREATE UNIQUE INDEX on a partitioned table can silently attach an invalid, not-ready child index, le
Date: 2026-11-05 09:28:35
Message-ID: CAFiTN-ujxmh89Y-Y6cufj-Dm_VgKKR9cvEBPPJ6-N1RTgfvd7A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, Nov 4, 2026 at 9:04 AM shihao zhong <zhong950419(at)gmail(dot)com> wrote:
>
> Hi Dilip,
>
> Thanks for working on this! v2 looks great!
>
> I have one concern here:
>
> This patch skips partitioned indexes made with ON ONLY, which are invalid
> until their partitions are attached. This breaks a case that works on
> master:
>
> create table r (a int not null) partition by range (a);
> create table s partition of r for values from (0) to (100)
> partition by range (a);
> create table s1 partition of s for values from (0) to (100);
> alter table only s add primary key (a);
> alter table r add primary key (a);
>
> With v2 the last command fails:
>
> ERROR: multiple primary keys for table "s" are not allowed

Hmm, thats doesn't look good

> Maybe skip only invalid indexes that are not partitioned?

Yeah that seems like a right way to fix this. How about this?

--
Regards,
Dilip Kumar
Google

Attachment Content-Type Size
v3-0001-Ignore-invalid-leaf-indexes-on-partitions-during-.patch application/octet-stream 11.5 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2026-11-05 09:32:54 BUG #19832: convert() between BIG5 and EUC_TW returns different characters than PostgreSQL's own UTF-8 mappings
Previous Message Fujii Masao 2026-11-05 09:10:19 Re: BUG #19775: Incremental backup without data checksums restores a stale visibility map page after VACUUM truncati