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>
To: 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:49:02 -0700
Message-ID: <5dcd835a-cb91-6c67-4156-ed2787190b33@aklaver.com> (raw)
In-Reply-To: <2441078.1634838709@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>
	<FECE58B3-40D1-4FBA-867C-869C18B35582@gmail.com>
	<2441078.1634838709@sss.pgh.pa.us>

On 10/21/21 10:51, Tom Lane wrote:
> Toomas <toomas.kristin@gmail.com> writes:
>> 2) db=> select current_user, session_user;
>>   current_user | session_user
>> --------------+--------------
>>   db_owner      | db_user
>> (1 row)
> 
> Given that setup, I wonder which role you expected \password to change.
> 
> If we target the current_user, we can expect the command to succeed.
> I'm just wondering if people will find that surprising.
> Targeting the session_user might be less surprising (or not?)
> but as this example shows, it can fail.

Well from here:

https://www.postgresql.org/docs/current/sql-set-session-authorization.html

'The current user identifier is relevant for permission checking.'

To me current_user would be the less surprising choice.

> 
> One thing that would help, regardless of which definition we think
> is most appropriate, is to have \password explicitly say which role
> it's intending to set the password for:
> 
> db=> \password
> Enter new password for role "dbowner":
> Enter it again:

Yes, that would be helpful in untangling who you are actually pointing at.

> 
> 			regards, tom lane
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com





view thread (14+ messages)  latest in thread

Message-ID: <5dcd835a-cb91-6c67-4156-ed2787190b33@aklaver.com>
Permalink:  ../5dcd835a-cb91-6c67-4156-ed2787190b33@aklaver.com/
Also on:    postgresql.org/message-id/5dcd835a-cb91-6c67-4156-ed2787190b33@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: <5dcd835a-cb91-6c67-4156-ed2787190b33@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> <FECE58B3-40D1-4FBA-867C-869C18B35582@gmail.com> <2441078.1634838709@sss.pgh.pa.us> <5dcd835a-cb91-6c67-4156-ed2787190b33@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