Introduce SYSTEM_USER

Enterprise / PostgreSQL - Michael Paquier [paquier.xyz] - 29 September 2022 06:05 UTC

SYSTEM_USER is a reserved keyword of the SQL specification that, roughly described, is aimed at reporting some information about the system user who has connected to the database server. It may include implementation-specific information about the means by the user connected, like an authentication method.

This commit implements SYSTEM_USER as of auth_method:identity, where "auth_method" is a keyword about the authentication method used to log into the server (like peer, md5, scram-sha-256, gss, etc.) and "identity" is the authentication identity as introduced by 9afffcb (peer sets authn to the OS user name, gss to the user principal, etc.). This format has been suggested by Tom Lane.

Note that thanks to d951052, SYSTEM_USER is available to parallel workers.

Bump catalog version.

Author: Bertrand Drouvot

0823d061b0 Introduce SYSTEM_USER
doc/src/sgml/func.sgml | 19 ++++++++++++
src/backend/access/transam/parallel.c | 8 +++++
src/backend/parser/gram.y | 11 ++++++-
src/backend/utils/adt/ruleutils.c | 4 +++
src/backend/utils/init/miscinit.c | 50 +++++++++++++++++++++++++++++++
src/backend/utils/init/postinit.c | 4 +++
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_proc.dat | 3 ++
src/include/miscadmin.h | 3 ++
src/include/parser/kwlist.h | 1 +
src/test/authentication/t/001_password.pl | 42 ++++++++++++++++++++++++++
src/test/kerberos/t/001_auth.pl | 28 +++++++++++++++--
src/test/regress/expected/create_view.out | 6 ++--
src/test/regress/sql/create_view.sql | 3 +-
14 files changed, 177 insertions(+), 7 deletions(-)

Upstream: git.postgresql.org


  • Share