Native partitioning tablespace inheritance

From: Keith Fiske <keith(dot)fiske(at)crunchydata(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Native partitioning tablespace inheritance
Date: 2018-04-11 16:52:06
Message-ID: CAODZiv6EBULTz1dP2KV84XMGgDaG=R3TxodK+ovwHSPWECK8sQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Just had someone report that pg_partman wasn't handling tablespaces for
native partitioning.

https://github.com/keithf4/pg_partman/issues/212

I'd assumed that that was a property that was being inherited from the
parent table, but apparently the TABLESPACE flag to CREATE TABLE is
completely ignored for the parent table. I know the documentation states
that you can set the tablespace per child table, but accepting the flag on
the parent and completely ignoring it seems rather misleading to me.

keith(at)keith=# CREATE TABLE XXXX(YYYYYY TIMESTAMP NOT NULL) PARTITION BY
RANGE (YYYYYY ) TABLESPACE mytablespace;
CREATE TABLE
Time: 11.569 ms
keith(at)keith=# \d+ xxxx;
Table "public.xxxx"
Column | Type | Collation | Nullable | Default |
Storage | Stats target | Description
--------+-----------------------------+-----------+----------+---------+---------+--------------+-------------
yyyyyy | timestamp without time zone | | not null | |
plain | |
Partition key: RANGE (yyyyyy)

keith(at)keith=# select relname, reltablespace from pg_class where relname =
'xxxx';
relname | reltablespace
---------+---------------
xxxx | 0
(1 row)

Any chance of this being an inheritable property that can simply be
overridden if the TABLESPACE flag is set when creating a child table? If
it's not set, just set the tablespace to whatever was set for the parent.

For now, partman is going to have to rely on the template table option to
handle this the same way it does for indexes right now.

--
Keith Fiske
Senior Database Engineer
Crunchy Data - http://crunchydata.com

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2018-04-11 16:54:34 Re: Creation of wiki page for open items of v11
Previous Message Tom Lane 2018-04-11 16:51:29 Re: 'make check' fails