pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Murillo corvino rocha <murillo_corvinorocha@hotmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: RES: RES: session_user different from current_user after normal login
Date: Fri, 18 Nov 2022 13:04:49 -0800
Message-ID: <d3d1136c-10e7-992a-8a53-56a52b02bd0b@aklaver.com> (raw)
In-Reply-To: <CO6PR17MB502803F8C1B7083C5162E2E3EB099@CO6PR17MB5028.namprd17.prod.outlook.com>
References: <CO6PR17MB50288F5AC97DF80B8EAB6B67EB069@CO6PR17MB5028.namprd17.prod.outlook.com>
	<359ae842-c217-1055-e24b-173918c1e5f3@aklaver.com>
	<CO6PR17MB5028A71BE4007805FB33C8C3EB069@CO6PR17MB5028.namprd17.prod.outlook.com>
	<2184327.1668781907@sss.pgh.pa.us>
	<CO6PR17MB502803F8C1B7083C5162E2E3EB099@CO6PR17MB5028.namprd17.prod.outlook.com>

On 11/18/22 12:52, Murillo corvino rocha wrote:
> Could it be the role=group_read_only? The fact that user1 is a member of 
> group_read_only is changing current_user variable?

Well role=group_read_only means this:

	psql -d database -h host -U user1

effectively becomes:

	psql -d database -h host -U user1

log in as user1 then

	SET ROLE group_read_only;

which results in

	session_user: user1

	current_user: group_read_only.


user_1 being a member of group_read_only does not automatically change 
the current_user to group_read_only. This happened because it was 
explicitly set up do this.

> 
> I’m using a clean psql docker container everytime I need to connect to 
> the database, so, I don’t think it’s related to psql.
> 
> \drds
> 
>                      List of settings
> 
>     Role        | Database |             Settings
> 
> --------------+--------------+-----------------------------------
> 
> user1        | mydb       | role=group_read_only
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com






view thread (3+ messages)  latest in thread

Message-ID: <d3d1136c-10e7-992a-8a53-56a52b02bd0b@aklaver.com>
Permalink:  ../d3d1136c-10e7-992a-8a53-56a52b02bd0b@aklaver.com/
Also on:    postgresql.org/message-id/d3d1136c-10e7-992a-8a53-56a52b02bd0b@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, murillo_corvinorocha@hotmail.com, tgl@sss.pgh.pa.us
  Subject: Re: session_user different from current_user after normal login
  In-Reply-To: <d3d1136c-10e7-992a-8a53-56a52b02bd0b@aklaver.com>
  References: <CO6PR17MB50288F5AC97DF80B8EAB6B67EB069@CO6PR17MB5028.namprd17.prod.outlook.com> <359ae842-c217-1055-e24b-173918c1e5f3@aklaver.com> <CO6PR17MB5028A71BE4007805FB33C8C3EB069@CO6PR17MB5028.namprd17.prod.outlook.com> <2184327.1668781907@sss.pgh.pa.us> <CO6PR17MB502803F8C1B7083C5162E2E3EB099@CO6PR17MB5028.namprd17.prod.outlook.com> <d3d1136c-10e7-992a-8a53-56a52b02bd0b@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