Add permission check for MERGE/SPLIT partition operations
authorAlexander Korotkov <akorotkov@postgresql.org>
Sun, 12 May 2024 21:00:21 +0000 (00:00 +0300)
committerAlexander Korotkov <akorotkov@postgresql.org>
Sun, 12 May 2024 21:00:21 +0000 (00:00 +0300)
commit3ca43dbbb67fbfb96dec8de2e268b96790555148
tree27ab10f579795e11066f08deeb8a7585a10b3b98
parentcff4e5a36bfe1191a688c5eaff7ba095588ba732
Add permission check for MERGE/SPLIT partition operations

Currently, we check only owner permission for the parent table before
MERGE/SPLIT partition operations.  This leads to a security hole when users
can get access to the data of partitions without permission.  This commit
fixes this problem by requiring owner permission on all the partitions
involved.

Reported-by: Alexander Lakhin
Discussion: https://postgr.es/m/0520c72e-8d97-245e-53f9-173beca2ab2e%40gmail.com
Author: Dmitry Koval, Alexander Korotkov
src/backend/parser/parse_utilcmd.c
src/test/regress/expected/partition_merge.out
src/test/regress/expected/partition_split.out
src/test/regress/sql/partition_merge.sql
src/test/regress/sql/partition_split.sql