Search Postgresql Archives

session_user different from current_user after normal login

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

 

We have a situation where two users are members of a group, like below:

 

group_read_only

    |- user1

    |- user2

 

We tried to change the password for those users, using a query like below:

 

ALTER ROLE user1 PASSWORD 'sup3r$4fe';

 

but got a "ERROR: permission denied" (using pgadmin4 and psql docker clients). Using the

"\password" command, we got:

 

Enter new password for user "group_read_only"

 

and using the command "\password user1" we got the same "ERROR: permission denied".

 

After further investigation, and reaching the discussion https://www.postgresql.org/message-id/flat/B340250F-A0E3-43BF-A1FB-2AE36003F68D@xxxxxxxxx,

we first checked that using the query below:

 

SELECT session_user, current_user;

 

We got the result:

session_user: user1

current_user: group_read_only

 

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?

 

Thanks in advance.

 

Murillo.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux