pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: pgsql-committers@postgresql.org
Subject: pgsql: Allow CURRENT/SESSION_USER to be used in certain commands
Date: Mon, 09 Mar 2015 18:46:02 +0000
Message-ID: <E1YV2gk-0003FQ-PB@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Allow CURRENT/SESSION_USER to be used in certain commands

Commands such as ALTER USER, ALTER GROUP, ALTER ROLE, GRANT, and the
various ALTER OBJECT / OWNER TO, as well as ad-hoc clauses related to
roles such as the AUTHORIZATION clause of CREATE SCHEMA, the FOR clause
of CREATE USER MAPPING, and the FOR ROLE clause of ALTER DEFAULT
PRIVILEGES can now take the keywords CURRENT_USER and SESSION_USER as
user specifiers in place of an explicit user name.

This commit also fixes some quite ugly handling of special standards-
mandated syntax in CREATE USER MAPPING, which in particular would fail
to work in presence of a role named "current_user".

The special role specifiers PUBLIC and NONE also have more consistent
handling now.

Also take the opportunity to add location tracking to user specifiers.

Authors: Kyotaro Horiguchi.  Heavily reworked by Álvaro Herrera.
Reviewed by: Rushabh Lathia, Adam Brightwell, Marti Raudsepp.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/31eae6028eca4365e7165f5f33fee1ed0486aee0

Modified Files
--------------
doc/src/sgml/ref/alter_aggregate.sgml            |    3 +-
doc/src/sgml/ref/alter_collation.sgml            |    2 +-
doc/src/sgml/ref/alter_conversion.sgml           |    2 +-
doc/src/sgml/ref/alter_database.sgml             |    2 +-
doc/src/sgml/ref/alter_domain.sgml               |    2 +-
doc/src/sgml/ref/alter_event_trigger.sgml        |    2 +-
doc/src/sgml/ref/alter_foreign_data_wrapper.sgml |    2 +-
doc/src/sgml/ref/alter_foreign_table.sgml        |    2 +-
doc/src/sgml/ref/alter_function.sgml             |    2 +-
doc/src/sgml/ref/alter_group.sgml                |   10 +-
doc/src/sgml/ref/alter_language.sgml             |    2 +-
doc/src/sgml/ref/alter_large_object.sgml         |    2 +-
doc/src/sgml/ref/alter_materialized_view.sgml    |    2 +-
doc/src/sgml/ref/alter_opclass.sgml              |   11 +-
doc/src/sgml/ref/alter_operator.sgml             |    7 +-
doc/src/sgml/ref/alter_opfamily.sgml             |   19 +-
doc/src/sgml/ref/alter_role.sgml                 |   35 +-
doc/src/sgml/ref/alter_schema.sgml               |    2 +-
doc/src/sgml/ref/alter_sequence.sgml             |    2 +-
doc/src/sgml/ref/alter_server.sgml               |    2 +-
doc/src/sgml/ref/alter_table.sgml                |    2 +-
doc/src/sgml/ref/alter_tablespace.sgml           |    2 +-
doc/src/sgml/ref/alter_tsconfig.sgml             |    2 +-
doc/src/sgml/ref/alter_tsdictionary.sgml         |    2 +-
doc/src/sgml/ref/alter_type.sgml                 |    2 +-
doc/src/sgml/ref/alter_user.sgml                 |   16 +-
doc/src/sgml/ref/alter_user_mapping.sgml         |    2 +-
doc/src/sgml/ref/alter_view.sgml                 |    2 +-
doc/src/sgml/ref/create_schema.sgml              |   14 +-
doc/src/sgml/ref/grant.sgml                      |   33 +-
src/backend/catalog/aclchk.c                     |   54 +-
src/backend/commands/alter.c                     |    2 +-
src/backend/commands/extension.c                 |    2 +-
src/backend/commands/foreigncmds.c               |   58 +-
src/backend/commands/policy.c                    |   18 +-
src/backend/commands/schemacmds.c                |   21 +-
src/backend/commands/tablecmds.c                 |    4 +-
src/backend/commands/tablespace.c                |    2 +-
src/backend/commands/user.c                      |  116 +--
src/backend/nodes/copyfuncs.c                    |   49 +-
src/backend/nodes/equalfuncs.c                   |   45 +-
src/backend/parser/gram.y                        |  228 ++++--
src/backend/parser/parse_utilcmd.c               |    4 +-
src/backend/utils/adt/acl.c                      |  116 ++-
src/include/commands/user.h                      |    2 +-
src/include/nodes/nodes.h                        |    1 +
src/include/nodes/parsenodes.h                   |   50 +-
src/include/utils/acl.h                          |    8 +-
src/test/regress/expected/rolenames.out          |  940 ++++++++++++++++++++++
src/test/regress/parallel_schedule               |    2 +-
src/test/regress/serial_schedule                 |    1 +
src/test/regress/sql/rolenames.sql               |  434 ++++++++++
52 files changed, 2000 insertions(+), 347 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


view thread (2+ messages)  latest in thread

Message-ID: <E1YV2gk-0003FQ-PB@gemulon.postgresql.org>
Permalink:  ../E1YV2gk-0003FQ-PB@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1YV2gk-0003FQ-PB@gemulon.postgresql.org

 · 

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 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: alvherre@alvh.no-ip.org
  Subject: Re: pgsql: Allow CURRENT/SESSION_USER to be used in certain commands
  In-Reply-To: <E1YV2gk-0003FQ-PB@gemulon.postgresql.org>
  References: <E1YV2gk-0003FQ-PB@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