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

From: shihao zhong <zhong950419(at)gmail(dot)com>
To: Dilip Kumar <dilipbalaut(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-04 03:34:22
Message-ID: CAGRkXqTJeih2Dh8X3tniW6v_u3drDwJLczbOHQ1h23jFWNAsLQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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

Maybe skip only invalid indexes that are not partitioned?

Thanks,
Shihao

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message shihao zhong 2026-11-04 03:46:53 Re: set_config(‘search_path’) does not truncate names over 63 bytes, unlike SET
Previous Message David Rowley 2026-11-04 03:25:54 Re: BUG #19827: postgres_fdw: Assert in add_foreign_ordered_paths() with redundant ORDER BY in set-op input