pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Joe Conway <mail@joeconway.com>
Cc: Drouvot, Bertrand <bdrouvot@amazon.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: SYSTEM_USER reserved word implementation
Date: Wed, 22 Jun 2022 10:51:36 -0400
Message-ID: <3361134.1655909496@sss.pgh.pa.us> (raw)
In-Reply-To: <28b4a9ef-5103-f117-99e1-99ae5a86a6e8@joeconway.com>
References: <7e692b8c-0b11-45db-1cad-3afc5b57409f@amazon.com>
	<3338921.1655905757@sss.pgh.pa.us>
	<28b4a9ef-5103-f117-99e1-99ae5a86a6e8@joeconway.com>

Joe Conway <mail@joeconway.com> writes:
> On 6/22/22 09:49, Tom Lane wrote:
>> On what grounds do you argue that that's the appropriate meaning of
>> SYSTEM_USER?

> What else do you imagine it might mean?

I was hoping for some citation of the SQL spec.

> Here is SQL Server interpretation for example:
>    "SYSTEM_USER
>    Returns the name of the current data store user
>    as identified by the operating system."

Meh.  That's as clear as mud.  (a) A big part of the question here
is what is meant by "current" user, in the face of operations like
SET ROLE.  (b) "as identified by the operating system" does more to
confuse me than anything else.  The operating system only deals in
OS user names; does that wording mean that what you get back is an OS
user name rather than a SQL role name?

My immediate guess would be that the SQL committee only intends
to deal in SQL role names and therefore SYSTEM_USER is defined
to return one of those, but I've not gone looking in the spec
to be sure.

I'm also not that clear on what we expect authn_id to be, but
a quick troll in the code makes it look like it's not necessarily
a SQL role name, but might be some external identifier such as a
Kerberos principal.  If that's the case I think it's going to be
inappropriate to use SQL-spec syntax to return it.  I don't object
to inventing some PG-specific function for the purpose, though.

BTW, are there any security concerns about exposing such identifiers?

			regards, tom lane





view thread (42+ messages)  latest in thread

Message-ID: <3361134.1655909496@sss.pgh.pa.us>
Permalink:  ../3361134.1655909496@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3361134.1655909496@sss.pgh.pa.us

 · 

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-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, mail@joeconway.com, bdrouvot@amazon.com
  Subject: Re: SYSTEM_USER reserved word implementation
  In-Reply-To: <3361134.1655909496@sss.pgh.pa.us>
  References: <7e692b8c-0b11-45db-1cad-3afc5b57409f@amazon.com> <3338921.1655905757@sss.pgh.pa.us> <28b4a9ef-5103-f117-99e1-99ae5a86a6e8@joeconway.com> <3361134.1655909496@sss.pgh.pa.us>

* 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