public inbox for [email protected]
help / color / mirror / Atom feedFrom: Alexander Korotkov <[email protected]>
To: Dmitry Koval <[email protected]>
Cc: Pavel Borisov <[email protected]>
Cc: Justin Pryzby <[email protected]>
Cc: [email protected]
Subject: Re: Add SPLIT PARTITION/MERGE PARTITIONS commands
Date: Fri, 26 Jun 2026 22:50:36 +0300
Message-ID: <CAPpHfdsao-VXZYN8-vRm543EFUE7=4tq+hcTh5iEc6ikqWq_cQ@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <ZkN6EfjQGz8TOhbL@pryzbyj2023>
<CAPpHfdvz3S7SoRiaSk9C-Juy2EzHs6NC_c9uUR0i7bymKXkvuQ@mail.gmail.com>
<ai_c4-v8iLA2kXFV@pryzbyj2023>
<CAPpHfdvOvaPxMoUp3T6hf4UmAaOhdPCcw71OGUWDjTXvrTZ_JA@mail.gmail.com>
<CALT9ZEFrDgha=RyOuWru45FTk9Dbj5FF-fTw0NnE8n1FwBb2yg@mail.gmail.com>
<CAPpHfdvpzvNt=d_Csxe-TCtvF9MRNdeMtfJu3RkmTgBkkQbGUw@mail.gmail.com>
<CALT9ZEG0YmzH+3M6PixHUNq13pYt+yh8sAgonfaut=g_ij=oZw@mail.gmail.com>
<CAPpHfdtVp5Xxz59Zse+Gg_oWvZPpwjr+gcVtWq-5pTp0Rsh8gQ@mail.gmail.com>
<CALT9ZEG39=w6zvDqpKc479WjmeNGFMwdJxi=Ut7z4JUN386URg@mail.gmail.com>
<CAPpHfdte=WJQnEnEhf8cKZYE1rT-VfQ2mgh=1dCsCCdSYStSow@mail.gmail.com>
<aj6BPoziSb-F8aJz@pryzbyj2023>
<CALT9ZEG8F_oTZEp7vpqJH6Y4hGuQ6jEusETk+=C4XciedS0G1w@mail.gmail.com>
<[email protected]>
On Fri, Jun 26, 2026 at 6:20 PM Dmitry Koval <[email protected]> wrote:
> If we exclude case with DEFAULT partition, MERGE PARTITIONS command was
> intended to be used when an incorrect table partitioning was chosen.
> For example, a table was initially partitioned by month, but later we
> needed to change table partitioning by quarter. In this case, MERGE
> PARTITIONS command should merge several adjacent partitions into one.
> Current checks are made for this case.
>
> >- If there's *no* default partition, then I think the check should be
> >relaxed; it's sufficient to verify that the bounds of the merged
> >partition do not overlap with any partition which is not being merged;
>
> It's probably possible to do this. But in this case, the command will
> not exactly be "MERGE PARTITIONS" ("MERGE PARTITIONS & EXPAND"?).
+1,
We can implement a support for this for 20. For 19, I propose to
state the restriction more explicit in the docs. See the attached
patch.
------
Regards,
Alexander Korotkov
Supabase
Attachments:
[application/octet-stream] v1-0001-doc-clarify-MERGE-PARTITIONS-adjacency-requiremen.patch (1.6K, ../CAPpHfdsao-VXZYN8-vRm543EFUE7=4tq+hcTh5iEc6ikqWq_cQ@mail.gmail.com/2-v1-0001-doc-clarify-MERGE-PARTITIONS-adjacency-requiremen.patch)
download | inline diff:
From b60a0d867443af7ab45ec70de5d65df8f93ab90f Mon Sep 17 00:00:00 2001
From: Alexander Korotkov <[email protected]>
Date: Fri, 26 Jun 2026 22:44:01 +0300
Subject: [PATCH v1] doc: clarify MERGE PARTITIONS adjacency requirement
The existing description says the ranges of merged range-partitions
"must be adjacent in order to be merged" only under the heading
"If the DEFAULT partition is not in the list of merged partitions",
which can be misread as a restriction tied to the presence of a
default partition. In fact, merging non-adjacent ranges is rejected
regardless of whether the partitioned table has a default partition;
spell that out explicitly.
Reported-by: Justin Pryzby <[email protected]>
Discussion: https://postgr.es/m/aj6BPoziSb-F8aJz%40pryzbyj2023
---
doc/src/sgml/ref/alter_table.sgml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/doc/src/sgml/ref/alter_table.sgml b/doc/src/sgml/ref/alter_table.sgml
index 67a05593140..0df7396f268 100644
--- a/doc/src/sgml/ref/alter_table.sgml
+++ b/doc/src/sgml/ref/alter_table.sgml
@@ -1196,7 +1196,8 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
<listitem>
<para>
For range-partitioned tables, the ranges of merged partitions
- must be adjacent in order to be merged.
+ must be adjacent in order to be merged; this applies even if
+ the partitioned table has no default partition.
The partition bounds of merged partitions are combined to form the new partition bound for
<replaceable class="parameter">partition_name</replaceable>.
</para>
--
2.39.5 (Apple Git-154)
view thread (174+ 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], [email protected]
Subject: Re: Add SPLIT PARTITION/MERGE PARTITIONS commands
In-Reply-To: <CAPpHfdsao-VXZYN8-vRm543EFUE7=4tq+hcTh5iEc6ikqWq_cQ@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