pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alexander Korotkov <akorotkov@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Change the way ATExecMergePartitions() handles the name collisio
Date: Tue, 30 Apr 2024 09:00:58 +0000
Message-ID: <E1s1jM9-000lFj-Hl@gemulon.postgresql.org> (raw)

Change the way ATExecMergePartitions() handles the name collision

The name collision happens when the name of the new partition is the same as
the name of one of the merging partitions.  Currently, ATExecMergePartitions()
first gives the new partition a temporary name and then renames it when old
partitions are deleted.  That negatively influences the naming of related
objects like indexes and constrains, which could inherit a temporary name.

This commit changes the implementation in the following way.  A merging
partition gets renamed first, then the new partition is created with the
right name immediately.  This resolves the issue of the naming of related
objects.

Reported-by: Alexander Lakhin
Discussion: https://postgr.es/m/edfbd846-dcc1-42d1-ac26-715691b687d3%40postgrespro.ru
Author: Dmitry Koval, Alexander Korotkov
Reviewed-by: Robert Haas, Justin Pryzby, Pavel Borisov

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/885742b9f88b9386368ee94df8c94d154677ffba

Modified Files
--------------
src/backend/commands/tablecmds.c              | 63 +++++++++++++--------------
src/test/regress/expected/partition_merge.out | 25 +++++++++++
src/test/regress/sql/partition_merge.sql      | 18 ++++++++
3 files changed, 73 insertions(+), 33 deletions(-)



view thread (2+ messages)

Message-ID: <E1s1jM9-000lFj-Hl@gemulon.postgresql.org>
Permalink:  ../E1s1jM9-000lFj-Hl@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1s1jM9-000lFj-Hl@gemulon.postgresql.org

 · 

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: pgsql-committers@postgresql.org
  Cc: akorotkov@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Change the way ATExecMergePartitions() handles the name collisio
  In-Reply-To: <E1s1jM9-000lFj-Hl@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox