Re: Add SPLIT PARTITION/MERGE PARTITIONS commands

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Dmitry Koval <d(dot)koval(at)postgrespro(dot)ru>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Add SPLIT PARTITION/MERGE PARTITIONS commands
Date: 2025-05-21 00:35:35
Message-ID: CACJufxH=O1zR8nMeXcjSiRH6=2qPrD3JgfMapMTeT0D9yam95A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, May 12, 2025 at 4:31 PM Dmitry Koval <d(dot)koval(at)postgrespro(dot)ru> wrote:
>
> Hi!
>
> We (with colleagues) discussed further improvements to SPLIT/MERGE
> PARTITION(S). As a result of the discussion, the following answers to
> the questions remained:
>
> 1. Who should be the owner of new partitions (SPLIT PARTITION command)
> if owner of the partition being split is not the same as the current user?
> a) current user (since he is the one who creates new tables);
> b) the owner of the partitioned partition (since it is the owner of the
> table and should continue to own it).

per https://www.postgresql.org/docs/current/sql-altertable.html
"You must own the table to use ALTER TABLE."

That means the current user must own the to be SPLITed partition.
the new partitions owner should be current user (the one who did ALTER TABLE)

> 2. Who should be the owner of the new partition (MERGE PARTITIONS
> command) if the partitions being merged have different owners?
> a) current user (since he is the one who creates new table);
> b) merging of partitions should be forbidden if they have different owners.
>
let say:

alter table whatever_range merge partitions
( whatever_range_c, whatever_range_de )
into whatever_range_cde;

In this case, the current user must own
whatever_range_c and whatever_range_de to perform this operation.
and the current user will be the owner of whatever_range_cde.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hannu Krosing 2025-05-21 00:53:56 Re: Please update the pgconf.dev Unconference notes
Previous Message Michael Paquier 2025-05-21 00:34:02 Re: Add comment explaining why queryid is int64 in pg_stat_statements