Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1odNka-000723-Ie for pgsql-hackers@arkaria.postgresql.org; Wed, 28 Sep 2022 03:28:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1odNkX-0003HK-H2 for pgsql-hackers@arkaria.postgresql.org; Wed, 28 Sep 2022 03:28:41 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1odNkV-0003CS-NT for pgsql-hackers@lists.postgresql.org; Wed, 28 Sep 2022 03:28:41 +0000 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1odNkR-0001oz-Fr for pgsql-hackers@lists.postgresql.org; Wed, 28 Sep 2022 03:28:38 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 416AE320097A; Tue, 27 Sep 2022 23:28:32 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Tue, 27 Sep 2022 23:28:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm2; t=1664335711; x=1664422111; bh=ukLz3FWz87 8DIGfyf+FM2QATAOfmXScsXSajB7y6xME=; b=aEc4sxMXRfrYYxa10q3wNkthpG kyCTltWsy9JWQLXdfKvcrKf4+z7E7XsIvLe7MZWpuTOa+BuFtk8oI0LvPHn2+EXn 51H8tzpN9SBYYxWPX0ZliFnXLZ7y2QhOZogb6EzIE55WMSLrOPcHV+qyFU48R24M lsOFsUtFmRkbCxZvAWiSSV8+/DA4GaLe1GL1dHprPDFC7LjgHnR5RjkzpjpDtPGE h6f6U599l3/3CKY5pHIKW8ITzBhLPggLXbQLWHiZubQp5ZjB+RimwqJLRYkIpUnx 0EBMDJQTp2Qd/c4x1ZgrWoKIBfgVL6hQYgBqC8rXoacqK1NcsDJmiJdr/7qg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1664335711; x=1664422111; bh=ukLz3FWz878DIGfyf+FM2QATAOfm XScsXSajB7y6xME=; b=wTms8noOjGtQrnHs0ZL6bClDvXwVoP9XpZTYwddd3Prb oCA3I4FyqRQ0GfNBv3zOf4Hi1zusMnsZEzHc66L23f2IjPvkVKrdTFQqYjS6b7Yt JiXG/O/orUwLrwDUkH/jWWL0RUdn6pujBheUTH6G0qL5ELP4XkrxJB2n6l2B7kQa mdqQJnmZtClQvLqOs7p7aAkHijO2KtKghAbuT/KskZevqindX7f8hlgBQ2tQx8n1 TJIS8Ot4okpLyJngdY0aaV7pZN4+hvW8EjMxtUTmlcTbobWXgXvssG9AWBnPXIlF w9vctuD7fOZZkJaOParCSaLD+SghDGuoG1KPbo7bLg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeegjedgieelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredt tddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesph grqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteelieefudffhffhtdetleeg geegfffhkeeuveetiefgudduvedutefggeeivdejnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiih ii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 27 Sep 2022 23:28:29 -0400 (EDT) Date: Wed, 28 Sep 2022 12:28:25 +0900 From: Michael Paquier To: Jacob Champion Cc: "Drouvot, Bertrand" , Alvaro Herrera , Tom Lane , Joe Conway , PostgreSQL Hackers Subject: Re: SYSTEM_USER reserved word implementation Message-ID: References: <1da0e60c-bd85-9f2d-2039-103055338b00@amazon.com> <40b4e4d0-d034-ea19-3ec3-1557f498770f@amazon.com> <9dae37cb-abe0-a773-da74-3e2b62279d4c@amazon.com> <32514125-2688-00c3-0210-44a467dd0470@timescale.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="1vDHFB/D6GFWuwRd" Content-Disposition: inline In-Reply-To: <32514125-2688-00c3-0210-44a467dd0470@timescale.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --1vDHFB/D6GFWuwRd Content-Type: multipart/mixed; boundary="Eu6yC0lgY8sIOwQV" Content-Disposition: inline --Eu6yC0lgY8sIOwQV Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Sep 27, 2022 at 03:38:49PM -0700, Jacob Champion wrote: > On 9/26/22 06:29, Drouvot, Bertrand wrote: > Since there are only internal clients to the API, I'd argue this makes > more sense as an Assert(authn_id !=3D NULL), but I don't think it's a > dealbreaker. Using an assert() looks like a good idea from here. If this is called with a NULL authn, this could reflect a problem in the authentication logic. >> As far the assertion failure mentioned by Michael when moving the=20 >> SVFOP_SYSTEM_USER from NAMEOID to TEXTOID: V4 is assuming that it is=20 >> safe to force the collation to C_COLLATION_OID for SQLValueFunction=20 >> having a TEXT type, but I would be happy to also hear your thoughts=20 >> about it. >=20 > Unfortunately I don't have much to add here; I don't know enough about > the underlying problems. I have been looking at that, and after putting my hands on that this comes down to the facility introduced in 40c24bf. So, I think that we'd better use COERCE_SQL_SYNTAX so as there is no need to worry about the shortcuts this patch is trying to use with the collation setup. And there are a few tests for get_func_sql_syntax() in create_view.sql. Note that this makes the patch slightly shorter, and simpler. The docs still mentioned "name", and not "text". This brings in a second point. 40c24bf has refrained from removing SQLValueFunction, but based the experience on this thread I see a pretty good argument in doing the jump once and for all. This deserves a separate discussion, though. I'll do that and create a new thread. -- Michael --Eu6yC0lgY8sIOwQV Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v5-0001-system_user-implementation.patch" Content-Transfer-Encoding: quoted-printable diff --git a/src/include/catalog/pg_proc.dat b/src/include/catalog/pg_proc.= dat index 8b72f8a215..e89703a3bf 100644 --- a/src/include/catalog/pg_proc.dat +++ b/src/include/catalog/pg_proc.dat @@ -1508,6 +1508,9 @@ { oid =3D> '746', descr =3D> 'session user name', proname =3D> 'session_user', provolatile =3D> 's', prorettype =3D> 'name= ', proargtypes =3D> '', prosrc =3D> 'session_user' }, +{ oid =3D> '9977', descr =3D> 'system user name', + proname =3D> 'system_user', provolatile =3D> 's', prorettype =3D> 'text', + proargtypes =3D> '', prosrc =3D> 'system_user' }, =20 { oid =3D> '744', proname =3D> 'array_eq', prorettype =3D> 'bool', diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h index ee48e392ed..e7ebea4ff4 100644 --- a/src/include/miscadmin.h +++ b/src/include/miscadmin.h @@ -357,6 +357,9 @@ extern void InitializeSessionUserIdStandalone(void); extern void SetSessionAuthorization(Oid userid, bool is_superuser); extern Oid GetCurrentRoleId(void); extern void SetCurrentRoleId(Oid roleid, bool is_superuser); +extern void InitializeSystemUser(const char *authn_id, + const char *auth_method); +extern const char *GetSystemUser(void); =20 /* in utils/misc/superuser.c */ extern bool superuser(void); /* current user is superuser */ diff --git a/src/include/parser/kwlist.h b/src/include/parser/kwlist.h index 9a7cc0c6bd..ccc927851c 100644 --- a/src/include/parser/kwlist.h +++ b/src/include/parser/kwlist.h @@ -409,6 +409,7 @@ PG_KEYWORD("support", SUPPORT, UNRESERVED_KEYWORD, BARE= _LABEL) PG_KEYWORD("symmetric", SYMMETRIC, RESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("sysid", SYSID, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("system", SYSTEM_P, UNRESERVED_KEYWORD, BARE_LABEL) +PG_KEYWORD("system_user", SYSTEM_USER, RESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("table", TABLE, RESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("tables", TABLES, UNRESERVED_KEYWORD, BARE_LABEL) PG_KEYWORD("tablesample", TABLESAMPLE, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL) diff --git a/src/backend/access/transam/parallel.c b/src/backend/access/tra= nsam/parallel.c index 8cba888223..ee0985c7ed 100644 --- a/src/backend/access/transam/parallel.c +++ b/src/backend/access/transam/parallel.c @@ -1496,6 +1496,14 @@ ParallelWorkerMain(Datum main_arg) false); RestoreClientConnectionInfo(clientconninfospace); =20 + /* + * Initialize SystemUser now that MyClientConnectionInfo is restored. + * Also ensure that auth_method is actually valid, aka authn_id is not NU= LL. + */ + if (MyClientConnectionInfo.authn_id) + InitializeSystemUser(MyClientConnectionInfo.authn_id, + hba_authname(MyClientConnectionInfo.auth_method)); + /* Attach to the leader's serializable transaction, if SERIALIZABLE. */ AttachSerializableXact(fps->serializable_xact_handle); =20 diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y index 0d8d292850..94d5142a4a 100644 --- a/src/backend/parser/gram.y +++ b/src/backend/parser/gram.y @@ -743,7 +743,7 @@ static Node *makeRecursiveViewSelect(char *relname, Lis= t *aliases, Node *query); SERIALIZABLE SERVER SESSION SESSION_USER SET SETS SETOF SHARE SHOW SIMILAR SIMPLE SKIP SMALLINT SNAPSHOT SOME SQL_P STABLE STANDALONE_P START STATEMENT STATISTICS STDIN STDOUT STORAGE STORED STRICT_P STRIP_P - SUBSCRIPTION SUBSTRING SUPPORT SYMMETRIC SYSID SYSTEM_P + SUBSCRIPTION SUBSTRING SUPPORT SYMMETRIC SYSID SYSTEM_P SYSTEM_USER =20 TABLE TABLES TABLESAMPLE TABLESPACE TEMP TEMPLATE TEMPORARY TEXT_P THEN TIES TIME TIMESTAMP TO TRAILING TRANSACTION TRANSFORM @@ -15239,6 +15239,13 @@ func_expr_common_subexpr: { $$ =3D makeSQLValueFunction(SVFOP_SESSION_USER, -1, @1); } + | SYSTEM_USER + { + $$ =3D (Node *) makeFuncCall(SystemFuncName("system_user"), + NIL, + COERCE_SQL_SYNTAX, + @1); + } | USER { $$ =3D makeSQLValueFunction(SVFOP_USER, -1, @1); @@ -17120,6 +17127,7 @@ reserved_keyword: | SESSION_USER | SOME | SYMMETRIC + | SYSTEM_USER | TABLE | THEN | TO @@ -17500,6 +17508,7 @@ bare_label_keyword: | SYMMETRIC | SYSID | SYSTEM_P + | SYSTEM_USER | TABLE | TABLES | TABLESAMPLE diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/rule= utils.c index 2b7b1b0c0f..c418403537 100644 --- a/src/backend/utils/adt/ruleutils.c +++ b/src/backend/utils/adt/ruleutils.c @@ -10317,6 +10317,10 @@ get_func_sql_syntax(FuncExpr *expr, deparse_contex= t *context) appendStringInfoChar(buf, ')'); return true; =20 + case F_SYSTEM_USER: + appendStringInfoString(buf, "SYSTEM_USER"); + return true; + case F_XMLEXISTS: /* XMLEXISTS ... extra parens because args are c_expr */ appendStringInfoString(buf, "XMLEXISTS(("); diff --git a/src/backend/utils/init/miscinit.c b/src/backend/utils/init/mis= cinit.c index 683f616b1a..c9e55cdefd 100644 --- a/src/backend/utils/init/miscinit.c +++ b/src/backend/utils/init/miscinit.c @@ -477,6 +477,7 @@ static Oid AuthenticatedUserId =3D InvalidOid; static Oid SessionUserId =3D InvalidOid; static Oid OuterUserId =3D InvalidOid; static Oid CurrentUserId =3D InvalidOid; +static const char *SystemUser =3D NULL; =20 /* We also have to remember the superuser state of some of these levels */ static bool AuthenticatedUserIsSuperuser =3D false; @@ -548,6 +549,16 @@ SetSessionUserId(Oid userid, bool is_superuser) CurrentUserId =3D userid; } =20 +/* + * Return the system user representing the authenticated identity. + * It is defined in InitializeSystemUser() as auth_method:authn_id. + */ +const char * +GetSystemUser(void) +{ + return SystemUser; +} + /* * GetAuthenticatedUserId - get the authenticated user ID */ @@ -818,6 +829,45 @@ InitializeSessionUserIdStandalone(void) SetSessionUserId(BOOTSTRAP_SUPERUSERID, true); } =20 +/* + * Initialize the system user. + * + * This is built as auth_method:authn_id. + */ +void +InitializeSystemUser(const char *authn_id, const char *auth_method) +{ + char *system_user; + + /* call only once */ + Assert(SystemUser =3D=3D NULL); + + /* + * InitializeSystemUser should be called only when authn_id is not NULL, + * meaning that auth_method is valid. + */ + Assert(authn_id !=3D NULL); + + system_user =3D psprintf("%s:%s", auth_method, authn_id); + + /* Store SystemUser in long-lived storage */ + SystemUser =3D MemoryContextStrdup(TopMemoryContext, system_user); + pfree(system_user); +} + +/* + * SQL-function SYSTEM_USER + */ +Datum +system_user(PG_FUNCTION_ARGS) +{ + const char *sysuser =3D GetSystemUser(); + + if (sysuser) + PG_RETURN_DATUM(CStringGetTextDatum(sysuser)); + else + PG_RETURN_NULL(); +} =20 /* * Change session auth ID while running diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/pos= tinit.c index 4a207a7391..31b7e1de5d 100644 --- a/src/backend/utils/init/postinit.c +++ b/src/backend/utils/init/postinit.c @@ -904,6 +904,10 @@ InitPostgres(const char *in_dbname, Oid dboid, Assert(MyProcPort !=3D NULL); PerformAuthentication(MyProcPort); InitializeSessionUserId(username, useroid); + /* ensure that auth_method is actually valid, aka authn_id is not NULL */ + if (MyClientConnectionInfo.authn_id) + InitializeSystemUser(MyClientConnectionInfo.authn_id, + hba_authname(MyClientConnectionInfo.auth_method)); am_superuser =3D superuser(); } =20 diff --git a/src/test/authentication/t/001_password.pl b/src/test/authentic= ation/t/001_password.pl index 3e3079c824..b0b7aac4c0 100644 --- a/src/test/authentication/t/001_password.pl +++ b/src/test/authentication/t/001_password.pl @@ -72,6 +72,11 @@ $node->safe_psql('postgres', $node->safe_psql('postgres', "SET password_encryption=3D'md5'; CREATE ROLE md5_role LOGIN PASSWORD 'pa= ss';" ); +# Set up a table for tests of SYSTEM_USER. +$node->safe_psql( + 'postgres', + "CREATE TABLE sysuser_data (n) AS SELECT NULL FROM generate_series(1, 10); + GRANT ALL ON sysuser_data TO md5_role;"); $ENV{"PGPASSWORD"} =3D 'pass'; =20 # For "trust" method, all users should be able to connect. These users are= not @@ -82,6 +87,25 @@ test_role($node, 'scram_role', 'trust', 0, test_role($node, 'md5_role', 'trust', 0, log_unlike =3D> [qr/connection authenticated:/]); =20 +# SYSTEM_USER is null when not authenticated. +my $res =3D $node->safe_psql('postgres', "SELECT SYSTEM_USER IS NULL;"); +is($res, 't', "users with trust authentication use SYSTEM_USER =3D NULL"); + +# Test SYSTEM_USER with parallel workers when not authenticated. +$res =3D $node->safe_psql( + 'postgres', " + SET min_parallel_table_scan_size TO 0; + SET parallel_setup_cost TO 0; + SET parallel_tuple_cost TO 0; + SET max_parallel_workers_per_gather TO 2; + + SELECT bool_and(SYSTEM_USER IS NOT DISTINCT FROM n) FROM sysuser_d= ata; + ", + connstr =3D> "user=3Dmd5_role"); +is($res, 't', + "users with trust authentication use SYSTEM_USER =3D NULL in parallel wor= kers" +); + # For plain "password" method, all users should also be able to connect. reset_pg_hba($node, 'password'); test_role($node, 'scram_role', 'password', 0, @@ -120,6 +144,26 @@ test_role($node, 'md5_role', 'md5', 0, log_like =3D> [qr/connection authenticated: identity=3D"md5_role" method=3Dmd5/]); =20 +# Test SYSTEM_USER <> NULL with parallel workers. +$node->safe_psql( + 'postgres', + "TRUNCATE sysuser_data; +INSERT INTO sysuser_data SELECT 'md5:md5_role' FROM generate_series(1, 10)= ;", + connstr =3D> "user=3Dmd5_role"); +$res =3D $node->safe_psql( + 'postgres', " + SET min_parallel_table_scan_size TO 0; + SET parallel_setup_cost TO 0; + SET parallel_tuple_cost TO 0; + SET max_parallel_workers_per_gather TO 2; + + SELECT bool_and(SYSTEM_USER IS NOT DISTINCT FROM n) FROM sysuser_d= ata; + ", + connstr =3D> "user=3Dmd5_role"); +is($res, 't', + "users with md5 authentication use SYSTEM_USER =3D md5:role in parallel w= orkers" +); + # Tests for channel binding without SSL. # Using the password authentication method; channel binding can't work reset_pg_hba($node, 'password'); diff --git a/src/test/kerberos/t/001_auth.pl b/src/test/kerberos/t/001_auth= =2Epl index 47169a1d1e..a097e43afa 100644 --- a/src/test/kerberos/t/001_auth.pl +++ b/src/test/kerberos/t/001_auth.pl @@ -4,8 +4,8 @@ # Sets up a KDC and then runs a variety of tests to make sure that the # GSSAPI/Kerberos authentication and encryption are working properly, # that the options in pg_hba.conf and pg_ident.conf are handled correctly, -# and that the server-side pg_stat_gssapi view reports what we expect to -# see for each test. +# that the server-side pg_stat_gssapi view reports what we expect to +# see for each test and that SYSTEM_USER returns what we expect to see. # # Since this requires setting up a full KDC, it doesn't make much sense # to have multiple test scripts (since they'd have to also create their @@ -180,6 +180,13 @@ $node->start; =20 $node->safe_psql('postgres', 'CREATE USER test1;'); =20 +# Set up a table for SYSTEM_USER parallel worker testing. +$node->safe_psql('postgres', + "CREATE TABLE ids (id) AS SELECT 'gss:test1\@$realm' FROM generate_series= (1, 10);" +); + +$node->safe_psql('postgres', 'GRANT SELECT ON ids TO public;'); + note "running tests"; =20 # Test connection success or failure, and if success, that query returns t= rue. @@ -311,6 +318,23 @@ test_query( 'gssencmode=3Drequire', 'sending 100K lines works'); =20 +# Test that SYSTEM_USER works. +test_query($node, 'test1', 'SELECT SYSTEM_USER;', + qr/^gss:test1\@$realm$/s, 'gssencmode=3Drequire', 'testing system_user'); + +# Test that SYSTEM_USER works with parallel workers. +test_query( + $node, + 'test1', + "SET min_parallel_table_scan_size TO 0;\n" + . "SET parallel_setup_cost TO 0;\n" + . "SET parallel_tuple_cost TO 0;\n" + . "SET max_parallel_workers_per_gather TO 2;\n" + . "SELECT bool_and(SYSTEM_USER =3D id) FROM ids;", + qr/^t$/s, + 'gssencmode=3Drequire', + 'testing system_user with parallel workers'); + unlink($node->data_dir . '/pg_hba.conf'); $node->append_conf('pg_hba.conf', qq{hostgssenc all all $hostaddr/32 gss map=3Dmymap}); diff --git a/src/test/regress/expected/create_view.out b/src/test/regress/e= xpected/create_view.out index a828b1f6de..bf4ff30d86 100644 --- a/src/test/regress/expected/create_view.out +++ b/src/test/regress/expected/create_view.out @@ -1940,7 +1940,8 @@ select trim(trailing ' foo ') as rt, trim(E'\\000'::bytea from E'\\000Tom\\000'::bytea) as btb, trim(leading E'\\000'::bytea from E'\\000Tom\\000'::bytea) as ltb, - trim(trailing E'\\000'::bytea from E'\\000Tom\\000'::bytea) as rtb; + trim(trailing E'\\000'::bytea from E'\\000Tom\\000'::bytea) as rtb, + SYSTEM_USER as su; select pg_get_viewdef('tt201v', true); pg_get_viewdef = =20 --------------------------------------------------------------------------= --------------------- @@ -1961,7 +1962,8 @@ select pg_get_viewdef('tt201v', true); TRIM(TRAILING FROM ' foo '::text) AS rt, = + TRIM(BOTH '\x00'::bytea FROM '\x00546f6d00'::bytea) AS btb, = + TRIM(LEADING '\x00'::bytea FROM '\x00546f6d00'::bytea) AS ltb, = + - TRIM(TRAILING '\x00'::bytea FROM '\x00546f6d00'::bytea) AS rtb; + TRIM(TRAILING '\x00'::bytea FROM '\x00546f6d00'::bytea) AS rtb, = + + SYSTEM_USER AS su; (1 row) =20 -- corner cases with empty join conditions diff --git a/src/test/regress/sql/create_view.sql b/src/test/regress/sql/cr= eate_view.sql index 44a6775f90..913b4ee460 100644 --- a/src/test/regress/sql/create_view.sql +++ b/src/test/regress/sql/create_view.sql @@ -721,7 +721,8 @@ select trim(trailing ' foo ') as rt, trim(E'\\000'::bytea from E'\\000Tom\\000'::bytea) as btb, trim(leading E'\\000'::bytea from E'\\000Tom\\000'::bytea) as ltb, - trim(trailing E'\\000'::bytea from E'\\000Tom\\000'::bytea) as rtb; + trim(trailing E'\\000'::bytea from E'\\000Tom\\000'::bytea) as rtb, + SYSTEM_USER as su; select pg_get_viewdef('tt201v', true); =20 -- corner cases with empty join conditions diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index d8718ed61e..409967f754 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -22623,6 +22623,25 @@ SELECT * FROM pg_ls_dir('.') WITH ORDINALITY AS t(= ls,n); =20 + + + + system_user + + system_user + text + + + Returns the authentication method and the identity (if any) that t= he + user presented during the authentication cycle before they were + assigned a database role. It is represented as + auth_method:identity or + NULL if the user has not been authenticated (for + example if Trust authentication has + been used). + + + --Eu6yC0lgY8sIOwQV-- --1vDHFB/D6GFWuwRd Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmMzv1kACgkQnvQgOdby QH1G7xAAjZN5KzqPqXJeFIP3CQARRJNCiy+n6Tz5k6Gm5cRHPyTnxPpBzZy+xo5S iq1iZh2DmNt5egDy9+v1ksxNtX+DddU5/F+EGfTUCiVinzo9PzX0DQOvzWLRxdlB zE2v4z1/KAcT8ixNajpqg5+BaR9JHciNR4lYrZOZMazj9Xc/fJWucMXH4M7jkT+z rhPj14D+GzwoJUxv1NLil4CAovOmQkmWKsZ7bXlCn8k/Q/+BXuSC/IFSbGtnKTQz wGevhp+wJD8NX0E78+ku3rwy8WTO58DCtkwp65D/35SCzKK0i/vZMhWzd0v7oObw Z9ttC6KNLvnIT2o+B7gT22Gg+ZAX+McKWW31Jx8tMfOqJvYzHMRzHOY5x6TukaZL G3xA5O6g56slzYwtqlhQQNoS9lt/80ufHHbqeDv2zR2Bx72VwqbHgLloWNj195jE KgjOjMYJlhziR+IVOjGQo66Drcn2Gl/W2CbIlDVh1YYlPJqRNhANsufSA49R6htu MUpDu42zFINIGJndgMeQmuVc9QjCxlxUH3KkRadZY2B6soVp9okNg+lIJ8kZrRkf JFMAQFRR/WYabNoezXwEMo7I77WE//RKyVKEPwfrkzC3L5q9mm29inx+TbEj+AT1 2wOIRmkJVXqKXG6p31xkHWkK6APs1zqHz7+5Kve3WAsIzyJ18xQ= =zTfZ -----END PGP SIGNATURE----- --1vDHFB/D6GFWuwRd--