MERGE/SPLIT partition commands should create new partitions in the parent's tablespace?

Поиск
Список
Период
Сортировка
От Fujii Masao
Тема MERGE/SPLIT partition commands should create new partitions in the parent's tablespace?
Дата
Msg-id abaf390b-3320-40a5-8815-ef476db5cfe7@oss.nttdata.com
обсуждение исходный текст
Ответы Re: MERGE/SPLIT partition commands should create new partitions in the parent's tablespace?
Re: MERGE/SPLIT partition commands should create new partitions in the parent's tablespace?
Список pgsql-hackers
Hi,

I noticed that ALTER TABLE MERGE PARTITIONS and SPLIT PARTITION commands
always create new partitions in the default tablespace, regardless of
the parent's tablespace. However, the indexes of these new partitions inherit
the tablespaces of their parent indexes. This inconsistency seems odd.
Is this an oversight or intentional?

Here are the steps I used to test this:

-------------------------------------------------------
CREATE TABLESPACE tblspc LOCATION '/tmp/tblspc';
CREATE TABLE t (i int PRIMARY KEY USING INDEX TABLESPACE tblspc)
   PARTITION BY RANGE (i) TABLESPACE tblspc;

CREATE TABLE tp_0_1 PARTITION OF t FOR VALUES FROM (0) TO (1);
CREATE TABLE tp_1_2 PARTITION OF t FOR VALUES FROM (1) TO (2);

ALTER TABLE t MERGE PARTITIONS (tp_0_1, tp_1_2) INTO tp_0_2;

SELECT tablename, tablespace FROM pg_tables WHERE tablename IN ('t', 'tp_0_2') ORDER BY tablename;
  tablename | tablespace
-----------+------------
  t         | tblspc
  tp_0_2    | (null)
(2 rows)

SELECT indexname, tablespace FROM pg_indexes WHERE tablename IN ('t', 'tp_0_2') ORDER BY indexname;
   indexname  | tablespace
-------------+------------
  t_pkey      | tblspc
  tp_0_2_pkey | tblspc
-------------------------------------------------------


If it's an oversight, I've attached a patch to ensure these commands create
new partitions in the parent's tablespace.

Regards,

-- 
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION
Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: David Rowley
Дата:
Сообщение: Re: Use generation memory context for tuplestore.c
Следующее
От: Nitin Jadhav
Дата:
Сообщение: Re: Show WAL write and fsync stats in pg_stat_io