Re: Add SPLIT PARTITION/MERGE PARTITIONS commands - Mailing list pgsql-hackers

From Alexander Korotkov
Subject Re: Add SPLIT PARTITION/MERGE PARTITIONS commands
Date
Msg-id CAPpHfduDafmBYttv6ZMacq6qpjcyOjrUOC=7DVb4_nURiWLRzQ@mail.gmail.com
Whole thread Raw
In response to Re: Add SPLIT PARTITION/MERGE PARTITIONS commands  (jian he <jian.universality@gmail.com>)
Responses Re: Add SPLIT PARTITION/MERGE PARTITIONS commands
List pgsql-hackers
On Sat, Dec 20, 2025 at 1:15 PM jian he <jian.universality@gmail.com> wrote:
> On Sat, Dec 20, 2025 at 6:42 PM Alexander Korotkov <aekorotkov@gmail.com> wrote:
> >
> > Hi Kirill!
>
> > > reshke=# alter table only z merge partitions (z_1,z_2) into z_12;
> > > ALTER TABLE
> > > reshke=#
> > >
> > > ```
> > >
> > > IMO "alter table only ... merge partitions" does not make perfect
> > > sense and should be rejected rather than executed. WDYT?
> >
> > Could you, please, clarify your point? I didn't quite get it.  It
> > looks like pretty basic example of merging two adjacent partitions.
> >
>
> > reshke=# alter table only z merge partitions (z_1,z_2) into z_12;
> I think it should fail, because we are not applying to table "z" itself,
> For Split/Merge partitions, we are processing the whole partitioned
> table z hierarchy.
>
> alter table z merge partitions (z_1,z_2) into z_12;
> should work.
>
> I guess the attached maybe is what Krill wants.

Thank you.  I missed there is an ONLY keyword.  But I'm not sure about
the error message.  I don't think the problem with ONLY keyword is
that MERGE/SPLIT must be always recursive.  I think opposite, it's
always non-recursive and this is why ONLY is meaningless.  Otherwise,
we may decide to just leave it as it allowing ONLY.

------
Regards,
Alexander Korotkov
Supabase



pgsql-hackers by date:

Previous
From: Dilip Kumar
Date:
Subject: Re: Proposal: Conflict log history table for Logical Replication
Next
From: Pavel Stehule
Date:
Subject: Re: Inline non-SQL SRFs using SupportRequestSimplify