pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Toomas <toomas.kristin@gmail.com>
Cc: Vijaykumar Jain <vijaykumarjain.github@gmail.com>
Cc: pgsql-general <pgsql-general@lists.postgresql.org>
Subject: Re: Can db user change own password?
Date: Thu, 21 Oct 2021 12:52:26 -0700
Message-ID: <eb7cb73c-5710-9401-e2b7-2c7aa1738cb5@aklaver.com> (raw)
In-Reply-To: <2440551.1634838273@sss.pgh.pa.us>
References: <B340250F-A0E3-43BF-A1FB-2AE36003F68D@gmail.com>
	<62f56a19-0504-4d7b-5f73-b10e8206642a@aklaver.com>
	<EA29ACFC-830F-49D0-9DFD-8E1974DD791B@gmail.com>
	<e1647dd4-3801-1ccd-f452-910aec961060@aklaver.com>
	<CAM+6J96rw6_PA7vxbogGgnhPmha2A9Ux33sodmYwC6S404g42w@mail.gmail.com>
	<7FC82398-5C8C-4F2D-9620-D16E54E77091@gmail.com>
	<e2c57ee7-75d7-6a03-d9f2-052a8e880f9c@aklaver.com>
	<2424680.1634835237@sss.pgh.pa.us>
	<c501fee1-8290-83ad-737e-c7c75a5409b8@aklaver.com>
	<2440551.1634838273@sss.pgh.pa.us>

On 10/21/21 10:44, Tom Lane wrote:
> Adrian Klaver <adrian.klaver@aklaver.com> writes:
>> On 10/21/21 09:53, Tom Lane wrote:

>> I would suggest session(_)user to make it match with the rest of
>> documentation.
> 
> But that's not right either.
> 
> regression=# select session_user;
>   session_user
> --------------
>   postgres
> (1 row)
> 
> regression=# create user joe;
> CREATE ROLE
> regression=# set session authorization joe;
> SET
> regression=> select session_user;
>   session_user
> --------------
>   joe
> (1 row)
> 
> regression=> \password
> Enter new password:
> Enter it again:
> ERROR:  must be superuser to alter superuser roles or change superuser attribute
> regression=>

Hmm, I'm striking out on this one. Just now grasped that PQuser() is 
grabbing a user/role from the connection itself and that the effective 
role could be something entirely different.

> 
> Another angle to this: even without SET SESSION AUTHORIZATION, the
> existence of username mapping options in the pg_hba machinery means that
> the role name that psql thought it logged in with might have nothing to do
> with the role name that the server thinks is the authenticated user.
> There might be no SQL role by that name at all.  So what psql is doing
> here is flat-out wrong.  I'm still hesitant about changing the behavior in
> the back branches, though, especially given the lack of prior complaints.
> 
> 			regards, tom lane
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com





view thread (14+ messages)

Message-ID: <eb7cb73c-5710-9401-e2b7-2c7aa1738cb5@aklaver.com>
Permalink:  ../eb7cb73c-5710-9401-e2b7-2c7aa1738cb5@aklaver.com/
Also on:    postgresql.org/message-id/eb7cb73c-5710-9401-e2b7-2c7aa1738cb5@aklaver.com

 · 

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-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, tgl@sss.pgh.pa.us, toomas.kristin@gmail.com, vijaykumarjain.github@gmail.com
  Subject: Re: Can db user change own password?
  In-Reply-To: <eb7cb73c-5710-9401-e2b7-2c7aa1738cb5@aklaver.com>
  References: <B340250F-A0E3-43BF-A1FB-2AE36003F68D@gmail.com> <62f56a19-0504-4d7b-5f73-b10e8206642a@aklaver.com> <EA29ACFC-830F-49D0-9DFD-8E1974DD791B@gmail.com> <e1647dd4-3801-1ccd-f452-910aec961060@aklaver.com> <CAM+6J96rw6_PA7vxbogGgnhPmha2A9Ux33sodmYwC6S404g42w@mail.gmail.com> <7FC82398-5C8C-4F2D-9620-D16E54E77091@gmail.com> <e2c57ee7-75d7-6a03-d9f2-052a8e880f9c@aklaver.com> <2424680.1634835237@sss.pgh.pa.us> <c501fee1-8290-83ad-737e-c7c75a5409b8@aklaver.com> <2440551.1634838273@sss.pgh.pa.us> <eb7cb73c-5710-9401-e2b7-2c7aa1738cb5@aklaver.com>

* 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