pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
RES: RES: session_user different from current_user after normal login
3+ messages / 3 participants
[nested] [flat]

* RES: RES: session_user different from current_user after normal login
@ 2022-11-18 20:52 Murillo corvino rocha <murillo_corvinorocha@hotmail.com>
  2022-11-18 21:04 ` Re: RES: RES: session_user different from current_user after normal login Adrian Klaver <adrian.klaver@aklaver.com>
  2022-11-18 21:09 ` Re: RES: RES: session_user different from current_user after normal login Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 2 replies; 3+ messages in thread

From: Murillo corvino rocha @ 2022-11-18 20:52 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Adrian Klaver <adrian.klaver@aklaver.com>; pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

Could it be the role=group_read_only? The fact that user1 is a member of group_read_only is changing current_user variable?
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
rdsadmin | rdsadmin | log_min_messages=panic
rdsadmin |                   | TimeZone=utc                                       +
                   |                   | log_statement=all                                 +
                   |                   | log_min_error_statement=debug5   +
                   |                   | log_min_messages=panic                    +
                   |                   | exit_on_error=0                                     +
                   |                   | statement_timeout=0                           +
                   |                   | role=rdsadmin                                        +
                   |                   | auto_explain.log_min_duration=-1   +
                   |                   | temp_file_limit=-1                                +
                   |                   | search_path=pg_catalog, public         +
                   |                   | pg_hint_plan.enable_hint=off             +
                   |                   | default_transaction_read_only=off    +
                   |                   | default_tablespace=
                   | rdsadmin | auto_explain.log_min_duration=-1
(4 rows)

Thanks.

Murillo.

De: Tom Lane<mailto:tgl@sss.pgh.pa.us>
Enviado:sexta-feira, 18 de novembro de 2022 11:31
Para: Murillo corvino rocha<mailto:murillo_corvinorocha@hotmail.com>
Cc:Adrian Klaver<mailto:adrian.klaver@aklaver.com>; pgsql-general@lists.postgresql.org<mailto:pgsql-general@lists.postgresql.org>
Assunto: Re: RES: session_user different from current_user after normal login

Murillo corvino rocha <murillo_corvinorocha@hotmail.com> writes:
> I am just logging in (using psql) and doing the select: SELECT session_user, current_user;
> The PostgreSQL is an AWS RDS 12.12 instance. No script is being executed. No one besides me is connected to the database. Could it be any server level configuration? I’m pretty sure that few configurations were made to this database.

I believe it's possible to do ALTER USER ... SET ROLE ... or
ALTER DATABASE ... SET ROLE ..., which'd produce this sort of
effect.  psql's "\drds" metacommand would help remind you of
any such settings.  I can't offhand think of any other server-side
configuration that would do it.

                        regards, tom lane

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: RES: RES: session_user different from current_user after normal login
  2022-11-18 20:52 RES: RES: session_user different from current_user after normal login Murillo corvino rocha <murillo_corvinorocha@hotmail.com>
@ 2022-11-18 21:04 ` Adrian Klaver <adrian.klaver@aklaver.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Adrian Klaver @ 2022-11-18 21:04 UTC (permalink / raw)
  To: Murillo corvino rocha <murillo_corvinorocha@hotmail.com>; Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

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






^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: RES: RES: session_user different from current_user after normal login
  2022-11-18 20:52 RES: RES: session_user different from current_user after normal login Murillo corvino rocha <murillo_corvinorocha@hotmail.com>
@ 2022-11-18 21:09 ` Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 0 replies; 3+ messages in thread

From: Tom Lane @ 2022-11-18 21:09 UTC (permalink / raw)
  To: Murillo corvino rocha <murillo_corvinorocha@hotmail.com>; +Cc: Adrian Klaver <adrian.klaver@aklaver.com>; pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

Murillo corvino rocha <murillo_corvinorocha@hotmail.com> writes:
> \drds
>                     List of settings
>   Role        | Database     |             Settings
> --------------+--------------+-----------------------------------
>  user1        | mydb         | role=group_read_only

Yeah, that would explain it ... what applied that setting?

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2022-11-18 21:09 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-11-18 20:52 RES: RES: session_user different from current_user after normal login Murillo corvino rocha <murillo_corvinorocha@hotmail.com>
2022-11-18 21:04 ` Adrian Klaver <adrian.klaver@aklaver.com>
2022-11-18 21:09 ` Tom Lane <tgl@sss.pgh.pa.us>

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