From: | PG Bug reporting form <noreply(at)postgresql(dot)org> |
---|---|
To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Cc: | gatekeeper(dot)mail(at)gmail(dot)com |
Subject: | BUG #17211: Partitioned index partition does not inherit table partition tablespace |
Date: | 2021-10-01 18:07:11 |
Message-ID: | 17211-838c26a1bc30a9db@postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
The following bug has been logged on the website:
Bug reference: 17211
Logged by: Andy S
Email address: gatekeeper(dot)mail(at)gmail(dot)com
PostgreSQL version: 14.0
Operating system: Debian Bullseye
Description:
Suppose we have 2 tablespaces:
pg_default (which is slow)
fast
We also have a partitioned table:
create table a (id serial not null, b int not null primary key, c int not
null, d int) partition by hash (b);
and 2 partitions:
create table a_1 partition of a for values with (modulus 2, remainder 0);
create table a_2 partition of a for values with (modulus 2, remainder 1)
tablespace fast;
This successfully allocates table a_2 pages within the 'fast' tablespace;
but this fails to allocate a_2_pkey primary key index there too and the
result is the index is allocated on tablespace oid(0) which means pg_default
I guess, at least the corresponding relfilenode is allocated within the
pg_default tablespace.
There's also a CREATE TABLE hack for index/constraint declaration within the
command that allows USING INDEX TABLESPACE, though there's an unresolved
error loop in partitioned tables use-case for such a syntax:
create table a_2 partition of a (primary key using index tablespace fast)
for values with (modulus 2, remainder 1) tablespace fast;
fails since there's no primary key definition provided
create table a_2 partition of a (primary key (b) using index tablespace
fast) for values with (modulus 2, remainder 1) tablespace fast;
fails with 'ERROR: multiple primary keys for table "a_2" are not allowed'
The only possibility for a user to then allocate both index(es) and a table
on a non-default tablespace is to create a partition, scan pg_class/pg_index
to find all the names of indexes' partitions allocated for the new table,
traverse them programmatically and ALTER INDEX SET TABLESPACE them. Which
does not seem convenient since there's a simpler syntax/approach for a
regular table.
From | Date | Subject | |
---|---|---|---|
Next Message | Edouard HIBON | 2021-10-01 19:36:22 | Re: BUG #17206: the function array_cat(anyarray, anyarray) does not exist |
Previous Message | Tom Lane | 2021-10-01 16:53:08 | Re: BUG #17207: Bad cost estimate of Merge Join despite correct row estimate |