| From: | Pavel Borisov <pashkin(dot)elfe(at)gmail(dot)com> |
|---|---|
| To: | Alexander Korotkov <aekorotkov(at)gmail(dot)com> |
| Cc: | Justin Pryzby <pryzby(at)telsasoft(dot)com>, Dmitry Koval <d(dot)koval(at)postgrespro(dot)ru>, Alexander Lakhin <exclusion(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
| Subject: | Re: Add SPLIT PARTITION/MERGE PARTITIONS commands |
| Date: | 2026-06-24 10:44:35 |
| Message-ID: | CALT9ZEE9O6eMdj3fPH+g67zMPNWe3PEhZ69wnOOnb2NfO-jBgw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi, Alexander!
On Wed, 24 Jun 2026 at 14:25, Alexander Korotkov <aekorotkov(at)gmail(dot)com> wrote:
>
> On Mon, Jun 22, 2026 at 1:44 PM Pavel Borisov <pashkin(dot)elfe(at)gmail(dot)com> wrote:
> > On Sun, 21 Jun 2026 at 16:11, Alexander Korotkov <aekorotkov(at)gmail(dot)com> wrote:
> > >
> > > On Thu, Jun 18, 2026 at 6:49 PM Justin Pryzby <pryzby(at)telsasoft(dot)com> 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | vignesh C | 2026-06-24 10:49:25 | Re: Fix publisher-side sequence permission reporting |
| Previous Message | Maxime Schoemans | 2026-06-24 10:41:37 | Re: [PATCH] btree_gist: add cross-type integer operator support for GiST |