]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix SPLIT PARTITION range bound validation with DEFAULT
authorAlexander Korotkov <akorotkov@postgresql.org>
Tue, 19 May 2026 10:38:55 +0000 (13:38 +0300)
committerAlexander Korotkov <akorotkov@postgresql.org>
Tue, 19 May 2026 10:54:55 +0000 (13:54 +0300)
commit9354896920e4b2efd3b1b88caaea4e0c9071acb2
tree5e17aa4e0e24cf95729b9061d9a404774eb0bf64
parent1164a822729a496baedfc4068a6c86e247d5934e
Fix SPLIT PARTITION range bound validation with DEFAULT

When splitting a range partition and defining a new DEFAULT partition, the
validation checked the lower bound of the first explicit partition and the
upper bound of explicit partitions only when they were not first.  If there
was exactly one explicit non-DEFAULT partition, its upper bound was therefore
not checked.

This could allow the replacement partition to extend beyond the upper bound
of the partition being split, potentially overlapping another existing
partition.

Fix this by checking the upper bound whenever the explicit partition is the
last one.  Add a regression test covering the single explicit partition plus
DEFAULT case.

Author: Chao Li <lic@highgo.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: Zhenwei Shang <a934172442@gmail.com>
Reviewed-by: Dmitry Koval <d.koval@postgrespro.ru>
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>
Discussion: https://postgr.es/m/C18878AB-DEB2-4A61-9995-A035DD644B81@gmail.com
src/backend/partitioning/partbounds.c
src/test/regress/expected/partition_split.out
src/test/regress/sql/partition_split.sql