From: Robert Haas <rhaas@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Add a SET option to the GRANT command.
Date: Fri, 18 Nov 2022 18:42:45 +0000
Message-ID: <E1ow6K5-000m2p-6S@gemulon.postgresql.org> (raw)
Add a SET option to the GRANT command.
Similar to how the INHERIT option controls whether or not the
permissions of the granted role are automatically available to the
grantee, the new SET permission controls whether or not the grantee
may use the SET ROLE command to assume the privileges of the granted
role.
In addition, the new SET permission controls whether or not it
is possible to transfer ownership of objects to the target role
or to create new objects owned by the target role using commands
such as CREATE DATABASE .. OWNER. We could alternatively have made
this controlled by the INHERIT option, or allow it when either
option is given. An advantage of this approach is that if you
are granted a predefined role with INHERIT TRUE, SET FALSE, you
can't go and create objects owned by that role.
The underlying theory here is that the ability to create objects
as a target role is not a privilege per se, and thus does not
depend on whether you inherit the target role's privileges. However,
it's surely something you could do anyway if you could SET ROLE
to the target role, and thus making it contingent on whether you
have that ability is reasonable.
Design review by Nathan Bossat, Wolfgang Walther, Jeff Davis,
Peter Eisentraut, and Stephen Frost.
Discussion: http://postgr.es/m/CA+Tgmob+zDSRS6JXYrgq0NWdzCXuTNzT5eK54Dn2hhgt17nm8A@mail.gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/3d14e171e9e2236139e8976f3309a588bcc8683b
Modified Files
--------------
doc/src/sgml/catalogs.sgml | 11 +++
doc/src/sgml/func.sgml | 9 ++-
doc/src/sgml/ref/grant.sgml | 32 ++++++---
doc/src/sgml/ref/revoke.sgml | 8 +--
doc/src/sgml/ref/set_role.sgml | 9 ++-
doc/src/sgml/user-manag.sgml | 20 ++++--
src/backend/commands/alter.c | 2 +-
src/backend/commands/dbcommands.c | 4 +-
src/backend/commands/foreigncmds.c | 2 +-
src/backend/commands/publicationcmds.c | 2 +-
src/backend/commands/schemacmds.c | 4 +-
src/backend/commands/tablecmds.c | 2 +-
src/backend/commands/typecmds.c | 2 +-
src/backend/commands/user.c | 44 +++++++++++-
src/backend/commands/variable.c | 2 +-
src/backend/utils/adt/acl.c | 106 +++++++++++++++++++++-------
src/bin/pg_dump/pg_dumpall.c | 23 ++++--
src/include/catalog/pg_auth_members.h | 1 +
src/include/utils/acl.h | 3 +-
src/test/regress/expected/alter_generic.out | 38 +++++-----
src/test/regress/expected/foreign_data.out | 2 +-
src/test/regress/expected/privileges.out | 41 +++++++++++
src/test/regress/sql/privileges.sql | 39 ++++++++++
23 files changed, 315 insertions(+), 91 deletions(-)
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: rhaas@postgresql.org
Subject: Re: pgsql: Add a SET option to the GRANT command.
In-Reply-To: <E1ow6K5-000m2p-6S@gemulon.postgresql.org>
References: <E1ow6K5-000m2p-6S@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox