public inbox for [email protected]  
help / color / mirror / Atom feed
pgsql: MERGE ... DO NOTHING: require SELECT privileges
3+ messages / 1 participants
[nested] [flat]

* pgsql: MERGE ... DO NOTHING: require SELECT privileges
@ 2024-02-21 16:21 Alvaro Herrera <[email protected]>
  0 siblings, 0 replies; 3+ messages in thread

From: Alvaro Herrera @ 2024-02-21 16:21 UTC (permalink / raw)
  To: [email protected]

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
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4989ce72644b9d636b9b23c7a1719a405e62670b

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(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* pgsql: MERGE ... DO NOTHING: require SELECT privileges
@ 2024-02-21 16:21 Alvaro Herrera <[email protected]>
  0 siblings, 0 replies; 3+ messages in thread

From: Alvaro Herrera @ 2024-02-21 16:21 UTC (permalink / raw)
  To: [email protected]

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_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/90ad85db6a4e06c517c72de84e725c0222e0c529

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(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* pgsql: MERGE ... DO NOTHING: require SELECT privileges
@ 2024-02-21 16:21 Alvaro Herrera <[email protected]>
  0 siblings, 0 replies; 3+ messages in thread

From: Alvaro Herrera @ 2024-02-21 16:21 UTC (permalink / raw)
  To: [email protected]

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(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2024-02-21 16:21 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-02-21 16:21 pgsql: MERGE ... DO NOTHING: require SELECT privileges Alvaro Herrera <[email protected]>
2024-02-21 16:21 pgsql: MERGE ... DO NOTHING: require SELECT privileges Alvaro Herrera <[email protected]>
2024-02-21 16:21 pgsql: MERGE ... DO NOTHING: require SELECT privileges Alvaro Herrera <[email protected]>

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