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

* RES: session_user different from current_user after normal login
@ 2022-11-17 21:26  Murillo corvino rocha <murillo_corvinorocha@hotmail.com>
  0 siblings, 2 replies; 4+ messages in thread

From: Murillo corvino rocha @ 2022-11-17 21:26 UTC (permalink / raw)
  To: Adrian Klaver <adrian.klaver@aklaver.com>; pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

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.

Murillo.

De: Adrian Klaver<mailto:adrian.klaver@aklaver.com>
Enviado:quinta-feira, 17 de novembro de 2022 14:35
Para: Murillo corvino rocha<mailto:murillo_corvinorocha@hotmail.com>; pgsql-general@lists.postgresql.org<mailto:pgsql-general@lists.postgresql.org>
Assunto: Re: session_user different from current_user after normal login

On 11/17/22 07:11, Murillo corvino rocha wrote:
> Hi,
>
> We have a situation where two users are members of a group, like below:
>

> Following the solution in the discussion above, we solved our problem
> using the command:
>
> SET SESSION AUTHORIZATION <username>;
>
> For our example:
>
> SET SESSION AUTHORIZATION user1;
>
> After that, it was possible to change the user password.
>
> My question is: is that a normal behavior? should I, after a normal
> loggin, be logged as
>
> group_read_only as my current_user?

Something or someone is doing SET ROLE group_read_only.

>
> Thanks in advance.
>
> Murillo.
>

--
Adrian Klaver
adrian.klaver@aklaver.com

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

* Re: RES: session_user different from current_user after normal login
@ 2022-11-17 22:54  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: Murillo corvino rocha <murillo_corvinorocha@hotmail.com>
  1 sibling, 1 reply; 4+ messages in thread

From: Adrian Klaver @ 2022-11-17 22:54 UTC (permalink / raw)
  To: Murillo corvino rocha <murillo_corvinorocha@hotmail.com>; pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

On 11/17/22 13:26, Murillo corvino rocha wrote:
> 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.

Is there a psqlrc file that has SET ROLE group_read_only;?

See the:

Files

psqlrc and ~/.psqlrc

section here:

https://www.postgresql.org/docs/current/app-psql.html

for more information.

> 
> Murillo.
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com






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

* RES: session_user different from current_user after normal login
@ 2022-11-17 23:53  Murillo corvino rocha <murillo_corvinorocha@hotmail.com>
  parent: Adrian Klaver <adrian.klaver@aklaver.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Murillo corvino rocha @ 2022-11-17 23:53 UTC (permalink / raw)
  To: Adrian Klaver <adrian.klaver@aklaver.com>; pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

No, I’m using a clean psql docker container everytime I need to connect to the database like below:

docker run -it --rm postgres psql -d database -h host -U user1


Murillo.

De: Adrian Klaver<mailto:adrian.klaver@aklaver.com>
Enviado:quinta-feira, 17 de novembro de 2022 19:54
Para: Murillo corvino rocha<mailto:murillo_corvinorocha@hotmail.com>; pgsql-general@lists.postgresql.org<mailto:pgsql-general@lists.postgresql.org>
Assunto: Re: RES: session_user different from current_user after normal login

On 11/17/22 13:26, Murillo corvino rocha wrote:
> 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.

Is there a psqlrc file that has SET ROLE group_read_only;?

See the:

Files

psqlrc and ~/.psqlrc

section here:

https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.postgresql.org%2Fdocs%2Fcurren...

for more information.

>
> Murillo.
>


--
Adrian Klaver
adrian.klaver@aklaver.com

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

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

From: Tom Lane @ 2022-11-18 14:31 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:
> 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] 4+ messages in thread


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

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-11-17 21:26 RES: session_user different from current_user after normal login Murillo corvino rocha <murillo_corvinorocha@hotmail.com>
2022-11-17 22:54 ` Adrian Klaver <adrian.klaver@aklaver.com>
2022-11-17 23:53   ` Murillo corvino rocha <murillo_corvinorocha@hotmail.com>
2022-11-18 14:31 ` 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