Re: Add SPLIT PARTITION/MERGE PARTITIONS commands

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
Cc: Kirill Reshke <reshkekirill(at)gmail(dot)com>, zengman <zengman(at)halodbtech(dot)com>, pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Add SPLIT PARTITION/MERGE PARTITIONS commands
Date: 2025-12-20 11:14:53
Message-ID: CACJufxEJhJvPP-j1iTDCmD+HO14b8ZiTys+sJN8mJxDnL5BpRQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Dec 20, 2025 at 6:42 PM Alexander Korotkov <aekorotkov(at)gmail(dot)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.

--
jian
https://www.enterprisedb.com

Attachment Content-Type Size
v1-0001-disallow-ALTER-TABLE-ONLY-in-MERGE-SPLIT-PARTITIONS.patch application/x-patch 7.6 KB
v1-0001-disallow-ALTER-TABLE-ONLY-in-MERGE-SPLIT-PARTITIONS.patch application/x-patch 7.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2025-12-20 11:20:53 Re: Proposal: Conflict log history table for Logical Replication
Previous Message Alexander Korotkov 2025-12-20 11:07:51 Re: Add SPLIT PARTITION/MERGE PARTITIONS commands