summaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorFujii Masao2024-07-15 04:11:51 +0000
committerFujii Masao2024-07-15 04:11:51 +0000
commitc0868966253218d83caeeac4bfd92ca6f4994537 (patch)
tree780481d7c893ca2a14884413974c2822e3588ac5 /src/backend
parent069d0ff0226b9ac999030b894db8defd4df186e0 (diff)
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/[email protected]
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/commands/tablecmds.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index b0bc9140138..721d24783b4 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -20340,7 +20340,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);