public inbox for [email protected]  
help / color / mirror / Atom feed
From: jian he <[email protected]>
To: Dmitry Koval <[email protected]>
Cc: Alexander Korotkov <[email protected]>
Cc: [email protected]
Subject: Re: Add SPLIT PARTITION/MERGE PARTITIONS commands
Date: Fri, 22 Aug 2025 11:36:45 +0800
Message-ID: <CACJufxEH45Rtkn=n9hjakeKEkH7ou8domh+iQHMp+18Wq_L-4g@mail.gmail.com> (raw)
In-Reply-To: <CACJufxE4o-m9Eu0OX33aUgfTVT3p7b3u242-CCJaOpWUaFhS=A@mail.gmail.com>
References: <171085360143.2046436.7217841141682511557.pgcf@coridan.postgresql.org>
	<CACJufxHakPGgUHfe4uThY2u_Hzq3YOP9m4B3gjZUTUm2mbVryA@mail.gmail.com>
	<CACJufxHo0u=PzgCn88VZEW0mtB=JopchqBTESudUMH+HCyiTpg@mail.gmail.com>
	<[email protected]>
	<CACJufxFTiAiN_27FzAE60Hm5yQ124EJ+b1dpNDstcSdCApFzLw@mail.gmail.com>
	<[email protected]>
	<CACJufxHjpdeDtOsmz9TyGX7jFU73LBEjX=JQpRQdAvDadT0coA@mail.gmail.com>
	<[email protected]>
	<CACJufxGSwvUwu2gyZfTzv=3TJ8Zu4=Kq-GB_pg3x5_5dpwYQkA@mail.gmail.com>
	<[email protected]>
	<CACJufxHM0sD8opy2hUxXLcdY3CQOCaMfsQtJs7yF3TS2YxSqKg@mail.gmail.com>
	<[email protected]>
	<CACJufxEWtK3utKjd7yMxRTGE54dJ8B+uigqvt1ocA4Q1mQ8qiQ@mail.gmail.com>
	<[email protected]>
	<CAPpHfdsW5_rFLwTfkYuG42nX5RbJCVhaC2vkn8p5GsT8Lseuyw@mail.gmail.com>
	<[email protected]>
	<CACJufxGEa6ZxP6d5VjZ6-Rpx=+u9zEE9ioRZRqQ=d_HYY6+daQ@mail.gmail.com>
	<CACJufxGh=L6YPr37Y4t+ZfReBeWdv8aiNEk7VoyhYyP7d6L-4w@mail.gmail.com>
	<CACJufxE4o-m9Eu0OX33aUgfTVT3p7b3u242-CCJaOpWUaFhS=A@mail.gmail.com>

On Thu, Aug 21, 2025 at 2:45 PM jian he <[email protected]> wrote:
>
> On Thu, Aug 21, 2025 at 10:53 AM jian he <[email protected]> wrote:
> >
> > > this time, I only checked
> > > v52-0001-Implement-ALTER-TABLE-.-MERGE-PARTITIONS-.-comma.patch

hi.

+static void
+check_two_partitions_bounds_range(Relation parent,
+{
....
+
+ ereport(ERROR,
+ errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
+ errmsg("lower bound of partition \"%s\" is not equal to the upper
bound of partition \"%s\"",
+   second_name->relname, first_name->relname),
+ errhint("ALTER TABLE ... MERGE PARTITIONS requires the partition
bounds to be adjacent."),
+ parser_errposition(pstate, datum->location));
+ }

I propose change it to:
        ereport(ERROR,
                errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
                errmsg("can not merge partition \"%s\" together with
partition \"%s\"",
                       second_name->relname, first_name->relname),
                errdetail("lower bound of partition \"%s\" is not
equal to the upper bound of partition \"%s\"",
                          second_name->relname, first_name->relname),
                errhint("ALTER TABLE ... MERGE PARTITIONS requires the
partition bounds to be adjacent."),
                parser_errposition(pstate, datum->location));


    <para>
+     There is also an option for merging multiple table partitions into
+     a single partition using the
+     <link linkend="sql-altertable-merge-partitions"><command>ALTER
TABLE ... MERGE PARTITIONS</command></link>.
+     This feature simplifies the management of partitioned tables by allowing
+     users to combine partitions that are no longer needed as
+     separate entities.  It's important to note that this operation is not
+     supported for hash-partitioned tables and acquires an
+     <literal>ACCESS EXCLUSIVE</literal> lock, which could impact high-load
+     systems due to the lock's restrictive nature.  For example, we can
+     merge three monthly partitions into one quarter partition:
I am not sure last sentence "merge three monthly partitions into one
quarter partition:"
is correct.


buildExpressionExecutionStates seems not needed, same reason as
mentioned before,
code pattern aligned with ATRewriteTable.
while at it, also did some minor changes.


Attachments:

  [application/octet-stream] v52-0001-refactor-buildExpressionExecutionStates.no-cfbot (4.2K, ../CACJufxEH45Rtkn=n9hjakeKEkH7ou8domh+iQHMp+18Wq_L-4g@mail.gmail.com/2-v52-0001-refactor-buildExpressionExecutionStates.no-cfbot)
  download

view thread (165+ 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], [email protected]
  Subject: Re: Add SPLIT PARTITION/MERGE PARTITIONS commands
  In-Reply-To: <CACJufxEH45Rtkn=n9hjakeKEkH7ou8domh+iQHMp+18Wq_L-4g@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