public inbox for [email protected]  
help / color / mirror / Atom feed
From: Xuneng Zhou <[email protected]>
To: Chao Li <[email protected]>
Cc: Postgres hackers <[email protected]>
Subject: Re: tablecmds: fix bug where index rebuild loses replica identity on partitions
Date: Mon, 6 Apr 2026 14:04:14 +0800
Message-ID: <CABPTF7X6F4q5zE7DSwRTo-xSdApbemE2CV8UJ8y=i8WvTtLc1Q@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<CABPTF7U_eJ6yeiGQcBPr5SVQS8wvGoo6j7b+6=_Kq3VTk3wSeg@mail.gmail.com>
	<[email protected]>
	<CABPTF7X-J4VCZbZfsCujhh4OE3tR73xws43ur2R1PFSMd21tpg@mail.gmail.com>
	<[email protected]>

On Tue, Mar 24, 2026 at 3:26 PM Chao Li <[email protected]> wrote:
>
>
>
> > On Mar 23, 2026, at 16:41, Xuneng Zhou <[email protected]> wrote:
> >
> > Hi,
> >
> > On Mon, Mar 23, 2026 at 3:57 PM Chao Li <[email protected]> wrote:
> > >
> > >
> > >
> > > > On Mar 21, 2026, at 18:29, Xuneng Zhou <[email protected]> wrote:
> > > >
> > > > On Thu, Mar 19, 2026 at 1:07 PM Chao Li <[email protected]> wrote:
> > > >>
> > > >>
> > > >>
> > > >>> On Feb 26, 2026, at 14:59, Chao Li <[email protected]> wrote:
> > > >>>
> > > >>>
> > > >>>
> > > >>>> On Jan 28, 2026, at 10:49, Chao Li <[email protected]> wrote:
> > > >>>>
> > > >>>>
> > > >>>>
> > > >>>>> On Jan 27, 2026, at 16:30, Chao Li <[email protected]> wrote:
> > > >>>>>
> > > >>>>>
> > > >>>>>
> > > >>>>>> On Jan 27, 2026, at 15:59, Chao Li <[email protected]> wrote:
> > > >>>>>>
> > > >>>>>>
> > > >>>>>>
> > > >>>>>>> On Jan 27, 2026, at 15:39, Michael Paquier <[email protected]> wrote:
> > > >>>>>>>
> > > >>>>>>> On Tue, Jan 27, 2026 at 01:13:32PM +0800, Chao Li wrote:
> > > >>>>>>>> I found this bug while working on a related patch [1].
> > > >>>>>>>>
> > > >>>>>>>> When ALTER TABLE ... ALTER COLUMN TYPE causes an index rebuild, and
> > > >>>>>>>> that index is used as REPLICA IDENTITY on a partitioned table, the
> > > >>>>>>>> replica identity marking on partitions can be silently lost after the
> > > >>>>>>>> rebuild.
> > > >>>>>>>
> > > >>>>>>> I am slightly confused by the tests included in the proposed patch.
> > > >>>>>>> On HEAD, if I undo the proposed changes of tablecmds.c, the tests
> > > >>>>>>> pass.  If I run the tests of the patch with the changes of
> > > >>>>>>> tablecmds.c, the tests also pass.
> > > >>>>>>
> > > >>>>>> Oops, that isn’t supposed to be so. I’ll check the test.
> > > >>>>>>
> > > >>>>>
> > > >>>>> Okay, I see the problem is here:
> > > >>>>> ```
> > > >>>>> +CREATE UNIQUE INDEX test_replica_identity_partitioned_pkey ON test_replica_identity_partitioned (id);
> > > >>>>> ```
> > > >>>>>
> > > >>>>> I missed to add column “val” into the index, so that alter type of val didn’t cause index rebuild.
> > > >>>>>
> > > >>>>> Ideally, it’s better to also verify that index OIDs should have changed before and after alter column type, but I haven’t figured out how to do so. Do you have an idea?
> > > >>>>
> > > >>>> I just updated the test to store index OIDs before and after rebuild into 2 temp tables, so that we can compare the OIDs to verify rebuild happens and replica identity preserved.
> > > >>>>
> > > >>>> I tried to port the test to master branch, and the test failed. 

view thread (9+ 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]
  Subject: Re: tablecmds: fix bug where index rebuild loses replica identity on partitions
  In-Reply-To: <CABPTF7X6F4q5zE7DSwRTo-xSdApbemE2CV8UJ8y=i8WvTtLc1Q@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