postgresql/src
Alexander Korotkov cdae794af3 Take into account default_tablespace during MERGE/SPLIT PARTITION(S)
createPartitionTable() passed the partitioned parent's reltablespace straight
to heap_create_with_catalog(), bypassing the default_tablespace GUC fallback
that DefineRelation() applies for CREATE TABLE ... PARTITION OF.  When the
parent had no explicit tablespace (reltablespace = 0), the new partition
unconditionally landed in the database default, even if default_tablespace
was set to something else; merging or splitting a set of partitions that all
lived in a non-default tablespace produced a new partition in the database
default.

Mirror DefineRelation()'s logic: take parent's reltablespace if set,
otherwise check GetDefaultTablespace() (which reads default_tablespace
and normalises pg_default / MyDatabaseTableSpace to InvalidOid).  Also
add the CREATE ACL check on the resolved tablespace and the pg_global
rejection, matching DefineRelation()'s behavior.

Update the documentation for MERGE/SPLIT PARTITION to spell out the
tablespace-selection rule explicitly.

Reported-by: Justin Pryzby <pryzby@telsasoft.com>
Reviewed-by: Pavel Borisov <pashkin.elfe@gmail.com>
Discussion: https://postgr.es/m/ajQTklv8QArzTp3h%40pryzbyj2023
2026-06-26 15:25:13 +03:00
..
backend Take into account default_tablespace during MERGE/SPLIT PARTITION(S) 2026-06-26 15:25:13 +03:00
bin Message and comment wording fixes 2026-06-25 10:51:22 +02:00
common Fix off-by-one with NFC recomposition for Hangul U+11A7 (TBASE) 2026-06-05 07:50:08 +09:00
fe_utils psql: Tighten heuristics for BEGIN/END within CREATE SCHEMA. 2026-06-23 14:12:03 -04:00
include Mark uuid-to-bytea cast as leakproof. 2026-06-25 14:25:57 -07:00
interfaces Fix null-pointer crash in ECPG compiler. 2026-06-25 16:58:29 -04:00
makefiles Add CONCURRENTLY option to REPACK 2026-04-06 21:55:08 +02:00
pl plperl: Fix NULL pointer dereference for forged array object 2026-06-24 09:09:48 +09:00
port Fix set of typos and grammar mistakes 2026-06-24 16:00:28 +09:00
template Switch the semaphore API on Solaris to unnamed POSIX. 2026-03-14 14:10:32 -04:00
test Take into account default_tablespace during MERGE/SPLIT PARTITION(S) 2026-06-26 15:25:13 +03:00
timezone Pre-beta mechanical code beautification, step 1: run pgindent. 2026-05-13 10:34:17 -04:00
tools plpython: Use funccache.c infrastructure for procedure caching. 2026-06-21 15:08:27 -04:00
tutorial Pre-beta mechanical code beautification, step 1: run pgindent. 2026-05-13 10:34:17 -04:00
.gitignore
DEVELOPERS
Makefile Add CONCURRENTLY option to REPACK 2026-04-06 21:55:08 +02:00
Makefile.global.in Update Unicode data to CLDR 48.2 2026-04-13 11:13:36 +02:00
Makefile.shlib Restore AIX support. 2026-02-23 13:34:22 -05:00
meson.build Update copyright for 2026 2026-01-01 13:24:10 -05:00
nls-global.mk Fix update-po for the PGXS case 2025-10-16 20:21:05 +02:00