]> git.ipfire.org Git - thirdparty/postgresql.git/commit
MERGE ... DO NOTHING: require SELECT privileges
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Wed, 21 Feb 2024 16:18:52 +0000 (17:18 +0100)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Wed, 21 Feb 2024 16:18:52 +0000 (17:18 +0100)
commit90ad85db6a4e06c517c72de84e725c0222e0c529
treeaf301cfb9b973e0999c291ecaea767230296896b
parent6ed995b13e1e0232a0e8b2f076831b7f76764ecd
MERGE ... DO NOTHING: require SELECT privileges

Verify that a user running MERGE with a DO NOTHING clause has
privileges to read the table, even if no columns are referenced.  Such
privileges were already required if the ON clause or any of the WHEN
conditions referenced any column at all, so there's no functional change
in practice.

This change fixes an assertion failure in the case where no column is
referenced by the command and the WHEN clauses are all DO NOTHING.

Backpatch to 15, where MERGE was introduced.

Reported-by: Alena Rybakina <a.rybakina@postgrespro.ru>
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Discussion: https://postgr.es/m/4d65a385-7efa-4436-a825-0869f89d9d92@postgrespro.ru
src/backend/parser/parse_merge.c
src/test/regress/expected/merge.out
src/test/regress/sql/merge.sql