Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
MasaoFujii committed Jul 15, 2024
1 parent c086896 commit 356e91c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
7 changes: 5 additions & 2 deletions src/test/regress/expected/partition_merge.out
Original file line number Diff line number Diff line change
Expand Up @@ -862,21 +862,24 @@ SET search_path = partitions_merge_schema, pg_temp, public;
ALTER TABLE t MERGE PARTITIONS (tp_0_1, tp_1_2) INTO tp_0_2;
ROLLBACK;
-- Check the new partition inherits parent's tablespace
SET search_path = partitions_merge_schema, pg_temp, public;
CREATE TABLE t (i int PRIMARY KEY USING INDEX TABLESPACE regress_tblspace)
PARTITION BY RANGE (i) TABLESPACE regress_tblspace;
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, tablespace;
WHERE tablename IN ('t', 'tp_0_2') AND schemaname = 'partitions_merge_schema'
ORDER BY tablename, tablespace;
tablename | tablespace
-----------+------------------
t | regress_tblspace
tp_0_2 | regress_tblspace
(2 rows)

SELECT tablename, indexname, tablespace FROM pg_indexes
WHERE tablename IN ('t', 'tp_0_2') ORDER BY tablename, indexname, tablespace;
WHERE tablename IN ('t', 'tp_0_2') AND schemaname = 'partitions_merge_schema'
ORDER BY tablename, indexname, tablespace;
tablename | indexname | tablespace
-----------+-------------+------------------
t | t_pkey | regress_tblspace
Expand Down
6 changes: 4 additions & 2 deletions src/test/regress/expected/partition_split.out
Original file line number Diff line number Diff line change
Expand Up @@ -1502,7 +1502,8 @@ ALTER TABLE t SPLIT PARTITION tp_0_2 INTO
(PARTITION tp_0_1 FOR VALUES FROM (0) TO (1),
PARTITION tp_1_2 FOR VALUES FROM (1) TO (2));
SELECT tablename, tablespace FROM pg_tables
WHERE tablename IN ('t', 'tp_0_1', 'tp_1_2') ORDER BY tablename, tablespace;
WHERE tablename IN ('t', 'tp_0_1', 'tp_1_2') AND schemaname = 'partition_split_schema'
ORDER BY tablename, tablespace;
tablename | tablespace
-----------+------------------
t | regress_tblspace
Expand All @@ -1511,7 +1512,8 @@ SELECT tablename, tablespace FROM pg_tables
(3 rows)

SELECT tablename, indexname, tablespace FROM pg_indexes
WHERE tablename IN ('t', 'tp_0_1', 'tp_1_2') ORDER BY tablename, indexname, tablespace;
WHERE tablename IN ('t', 'tp_0_1', 'tp_1_2') AND schemaname = 'partition_split_schema'
ORDER BY tablename, indexname, tablespace;
tablename | indexname | tablespace
-----------+-------------+------------------
t | t_pkey | regress_tblspace
Expand Down
7 changes: 5 additions & 2 deletions src/test/regress/sql/partition_merge.sql
Original file line number Diff line number Diff line change
Expand Up @@ -537,15 +537,18 @@ ALTER TABLE t MERGE PARTITIONS (tp_0_1, tp_1_2) INTO tp_0_2;
ROLLBACK;

-- Check the new partition inherits parent's tablespace
SET search_path = partitions_merge_schema, pg_temp, public;
CREATE TABLE t (i int PRIMARY KEY USING INDEX TABLESPACE regress_tblspace)
PARTITION BY RANGE (i) TABLESPACE regress_tblspace;
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, tablespace;
WHERE tablename IN ('t', 'tp_0_2') AND schemaname = 'partitions_merge_schema'
ORDER BY tablename, tablespace;
SELECT tablename, indexname, tablespace FROM pg_indexes
WHERE tablename IN ('t', 'tp_0_2') ORDER BY tablename, indexname, tablespace;
WHERE tablename IN ('t', 'tp_0_2') AND schemaname = 'partitions_merge_schema'
ORDER BY tablename, indexname, tablespace;
DROP TABLE t;

-- Check the new partition inherits parent's table access method
Expand Down
6 changes: 4 additions & 2 deletions src/test/regress/sql/partition_split.sql
Original file line number Diff line number Diff line change
Expand Up @@ -888,9 +888,11 @@ ALTER TABLE t SPLIT PARTITION tp_0_2 INTO
(PARTITION tp_0_1 FOR VALUES FROM (0) TO (1),
PARTITION tp_1_2 FOR VALUES FROM (1) TO (2));
SELECT tablename, tablespace FROM pg_tables
WHERE tablename IN ('t', 'tp_0_1', 'tp_1_2') ORDER BY tablename, tablespace;
WHERE tablename IN ('t', 'tp_0_1', 'tp_1_2') AND schemaname = 'partition_split_schema'
ORDER BY tablename, tablespace;
SELECT tablename, indexname, tablespace FROM pg_indexes
WHERE tablename IN ('t', 'tp_0_1', 'tp_1_2') ORDER BY tablename, indexname, tablespace;
WHERE tablename IN ('t', 'tp_0_1', 'tp_1_2') AND schemaname = 'partition_split_schema'
ORDER BY tablename, indexname, tablespace;
DROP TABLE t;

-- Check new partitions inherits parent's table access method
Expand Down

0 comments on commit 356e91c

Please sign in to comment.