pgsql: Fix GRANTED BY support in REVOKE ROLE statements

From: Daniel Gustafsson <dgustafsson(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix GRANTED BY support in REVOKE ROLE statements
Date: 2021-11-26 13:15:19
Message-ID: E1mqb4R-00065p-J6@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix GRANTED BY support in REVOKE ROLE statements

Commit 6aaaa76bb added support for the GRANTED BY clause in GRANT and
REVOKE statements, but missed adding support for checking the role in
the REVOKE ROLE case. Fix by checking that the parsed role matches the
CURRENT_ROLE/CURRENT_USER requirement, and also add some tests for it.
Backpatch to v14 where GRANTED BY support was introduced.

Discussion: https://postgr.es/m/B7F6699A-A984-4943-B9BF-CEB84C003527@yesql.se
Backpatch-through: 14

Branch
------
master

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

Modified Files
--------------
src/backend/commands/user.c | 11 +++++++++++
src/backend/parser/gram.y | 2 ++
src/test/regress/expected/privileges.out | 9 +++++++++
src/test/regress/sql/privileges.sql | 8 ++++++++
4 files changed, 30 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Daniel Gustafsson 2021-11-26 13:15:49 pgsql: Fix GRANTED BY support in REVOKE ROLE statements
Previous Message Peter Eisentraut 2021-11-26 09:01:22 pgsql: Update comments