pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Allow CURRENT/SESSION_USER to be used in certain commands
2+ messages / 2 participants
[nested] [flat]

* pgsql: Allow CURRENT/SESSION_USER to be used in certain commands
@ 2015-03-09 18:46  Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 1 reply; 2+ messages in thread

From: Alvaro Herrera @ 2015-03-09 18:46 UTC (permalink / raw)
  To: pgsql-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


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

* Re: pgsql: Allow CURRENT/SESSION_USER to be used in certain commands
@ 2015-03-09 19:16  Alvaro Herrera <alvherre@2ndquadrant.com>
  parent: Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Alvaro Herrera @ 2015-03-09 19:16 UTC (permalink / raw)
  To: pgsql-committers

Alvaro Herrera wrote:
> Allow CURRENT/SESSION_USER to be used in certain commands

hm, this created a crasher in ExecAlterDefaultPrivilegesStmt apparently.
I'm looking into it.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


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



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


end of thread, other threads:[~2015-03-09 19:16 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-03-09 18:46 pgsql: Allow CURRENT/SESSION_USER to be used in certain commands Alvaro Herrera <alvherre@alvh.no-ip.org>
2015-03-09 19:16 ` Alvaro Herrera <alvherre@2ndquadrant.com>

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