public inbox for [email protected]  
help / color / mirror / Atom feed
From: Pavel Borisov <[email protected]>
To: Alexander Korotkov <[email protected]>
Cc: Justin Pryzby <[email protected]>
Cc: Dmitry Koval <[email protected]>
Cc: Alexander Lakhin <[email protected]>
Cc: [email protected]
Cc: Tomas Vondra <[email protected]>
Cc: Alvaro Herrera <[email protected]>
Subject: Re: Add SPLIT PARTITION/MERGE PARTITIONS commands
Date: Wed, 24 Jun 2026 14:44:35 +0400
Message-ID: <CALT9ZEE9O6eMdj3fPH+g67zMPNWe3PEhZ69wnOOnb2NfO-jBgw@mail.gmail.com> (raw)
In-Reply-To: <CAPpHfdtPkk_gQdaKJQgd7Rh6wjqOEu8tGpmni7_1Dgo--rE=oA@mail.gmail.com>
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>
	<ajQTklv8QArzTp3h@pryzbyj2023>
	<CAPpHfduZ9Yd6vG0EOZUa_MOVxpEDMsZB-89pgNypwFzp2ax+NQ@mail.gmail.com>
	<CALT9ZEE9=LbuNx6t1duyXpRx7OM7W5NLirK+5b+8zzV8QrYDmw@mail.gmail.com>
	<CAPpHfdtPkk_gQdaKJQgd7Rh6wjqOEu8tGpmni7_1Dgo--rE=oA@mail.gmail.com>

Hi, Alexander!

On Wed, 24 Jun 2026 at 14:25, Alexander Korotkov <[email protected]> wrote:
>
> On Mon, Jun 22, 2026 at 1:44 PM Pavel Borisov <[email protected]> wrote:
> > On Sun, 21 Jun 2026 at 16:11, Alexander Korotkov <[email protected]> wrote:
> > >
> > > On Thu, Jun 18, 2026 at 6:49 PM Justin Pryzby <[email protected]> wrote:
> > > > On Thu, Jun 18, 2026 at 10:31:11AM +0300, Alexander Korotkov wrote:
> > > > > Pushed with your suggestions accepted.
> > > >
> > > > Thanks.  When I went back to test this, I merged ~25 partitions that
> > > > were all on the same tablespace, but the merged table was created on the
> > > > default tablespace.
> > > >
> > > > I tried again with default_tablespace set, but it was ignored.  I think
> > > > that's wrong.  It's good to follow the tablespace of the parent table,
> > > > but if it has no tablespace set, default_tablespace should be obeyed.
> > > > See surrounding logic in DefineRelation.
> > > >
> > > > I see the docs say this:
> > > > +       <command>ALTER TABLE MERGE PARTITION</command> uses the partitioned
> > > > +       table itself as the template to construct the new partition.
> > > > +       The new partition will inherit the same table access method, persistence
> > > > +       type, and tablespace as the partitioned table.
> > >
> > > Correct, please see the attached patch, it makes
> > > createPartitionTable() deal with tablespaces the same was as
> > > DefineRelation() does.
> >
> > Thank you for working on this feature!
> > I've looked into the last v1 patch.
> >
> > Does it also worth inheriting DefineRelation()'s check and error for
> > the case if (tablespaceId == GLOBALTABLESPACE_OID)?
> > A brief look for default_tablespace GUC doesn't reveal a way why it
> > could not be set to global tablespace in a session.
>
> Thank you for catching this.  I've added this check and corresponding tests.

Looked at the patch v2.
I think in test we'd better split comments for the failing block (SET
default_tablespace TO pg_global;) and for the successful block (after
RESET default_tablespace;). Otherwise, the comment paragraph looks a
little hard to read to me:
+-- Parent has no explicit tablespace and default_tablespace is empty: the
+-- new partition uses the database default (reltablespace = 0).  Also
+-- exercise the pg_global rejection path with default_tablespace pointing
+-- at the shared tablespace.

Overall the patch looks good to me.

Regards,
Pavel Borisov
Supabase






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], [email protected], [email protected], [email protected]
  Subject: Re: Add SPLIT PARTITION/MERGE PARTITIONS commands
  In-Reply-To: <CALT9ZEE9O6eMdj3fPH+g67zMPNWe3PEhZ69wnOOnb2NfO-jBgw@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