public inbox for [email protected]  
help / color / mirror / Atom feed
From: Alvaro Herrera <[email protected]>
To: [email protected]
Subject: pgsql: MERGE ... DO NOTHING: require SELECT privileges
Date: Wed, 21 Feb 2024 16:21:25 +0000
Message-ID: <[email protected]> (raw)

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 <[email protected]>
Reported-by: Alexander Lakhin <[email protected]>
Discussion: https://postgr.es/m/[email protected]

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/a3f5d2056ceba95d94607be3138fa52499a957e6

Modified Files
--------------
src/backend/parser/parse_merge.c    |  7 ++++++-
src/test/regress/expected/merge.out | 10 ++++++++++
src/test/regress/sql/merge.sql      | 11 +++++++++++
3 files changed, 27 insertions(+), 1 deletion(-)



view thread (3+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: pgsql: MERGE ... DO NOTHING: require SELECT privileges
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox