Skip to content

Using current_role/current_user when logged as the privileged_role crashes #108

Open
@steve-chavez

Description

@steve-chavez

Problem

When doing:

$ supautils-with-pg-16 psql -U postgres

-- these work as expected

postgres=# alter role current_user login;
ALTER ROLE

postgres=# set role authenticator;
SET
postgres=> alter role current_user login;
2025-01-31 16:24:11.273 -05 [1937471] ERROR:  "authenticator" is a reserved role, only superusers can modify it
2025-01-31 16:24:11.273 -05 [1937471] STATEMENT:  alter role current_user login;
ERROR:  "authenticator" is a reserved role, only superusers can modify it

But privileged_role crashes:

postgres=> set role privileged_role;
SET
-- same happenes for current_role
postgres=> alter role current_user login;
server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.
The connection to the server was lost. Attempting reset: 2025-01-31 16:24:44.210 -05 [1937454] LOG:  server process (PID 1937471) was terminated by signal 11: Segmentation fault
2025-01-31 16:24:44.210 -05 [1937454] DETAIL:  Failed process was running: alter role current_user login;
2025-01-31 16:24:44.210 -05 [1937454] LOG:  terminating any other active server processes
2025-01-31 16:24:44.211 -05 [1937483] FATAL:  the database system is in recovery mode
Failed.
The connection to the server was lost. Attempting reset: Failed.
!?> 2025-01-31 16:24:44.212 -05 [1937454] LOG:  all server processes terminated; reinitializing

It's minor since one can use the name of the actual role instead and changing privileged_role isn't allowed anyway.

postgres=> alter role privileged_role login;
2025-01-31 16:25:28.624 -05 [1937600] ERROR:  permission denied to alter role
2025-01-31 16:25:28.624 -05 [1937600] DETAIL:  Only superusers can alter privileged roles.
2025-01-31 16:25:28.624 -05 [1937600] STATEMENT:  alter role privileged_role login;
ERROR:  permission denied to alter role
DETAIL:  Only superusers can alter privileged roles.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingminor

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions