From 929390e4d860b641f72aece70280e66114bffbd0 Mon Sep 17 00:00:00 2001 From: Fujii Masao Date: Mon, 15 Jul 2024 13:11:51 +0900 Subject: Fix tablespace handling in MERGE/SPLIT partition commands. As commit ca4103025d stated, new partitions without a specified tablespace should inherit the parent relation's tablespace. However, previously, ALTER TABLE MERGE PARTITIONS and ALTER TABLE SPLIT PARTITION commands always created new partitions in the default tablespace, ignoring the parent's tablespace. This commit ensures new partitions inherit the parent's tablespace. Backpatch to v17 where these commands were introduced. Author: Fujii Masao Reviewed-by: Masahiko Sawada Discussion: https://postgr.es/m/abaf390b-3320-40a5-8815-ef476db5cfe7@oss.nttdata.com --- src/backend/commands/tablecmds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/backend/commands/tablecmds.c') diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index c406c90512b..937d47417e4 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -20358,7 +20358,7 @@ createPartitionTable(RangeVar *newPartName, Relation modelRel, createStmt->constraints = NIL; createStmt->options = NIL; createStmt->oncommit = ONCOMMIT_NOOP; - createStmt->tablespacename = NULL; + createStmt->tablespacename = get_tablespace_name(modelRel->rd_rel->reltablespace); createStmt->if_not_exists = false; createStmt->accessMethod = get_am_name(modelRel->rd_rel->relam); -- cgit v1.2.3