PG Bug reporting form <noreply@postgresql.org> writes:
> After minor release update to version 16.5 or 16.6 "set role" to role
> without "grant connect on database" generates error:
> "ERROR: Benutzer hat das CONNECT-Privileg nicht.keine Berechtigung für
> Datenbank »...«
> FEHLER: keine Berechtigung für Datenbank »...«
> SQL state: 42501
> Detail: Benutzer hat das CONNECT-Privileg nicht.
> Context: paralleler Arbeitsprozess"
This bug report is not actionable, because you didn't show what
you did to provoke the error. I did a little bit of testing
by guessing what you might be talking about, and I don't see
a problem:
regression=# create role r;
CREATE ROLE
regression=# create database d;
CREATE DATABASE
regression=# revoke connect on database d from public;
REVOKE
regression=# \c d
You are now connected to database "d" as user "postgres".
d=# set role r; -- should work, and does
SET
d=> reset role;
RESET
d=# create user joe;
CREATE ROLE
d=# grant r to joe;
GRANT ROLE
d=# alter user joe set role = r;
ALTER ROLE
d=# \c d joe -- should fail, and does
connection to server on socket "/tmp/.s.PGSQL.5432" failed: FATAL: permission denied for database "d"
DETAIL: User does not have CONNECT privilege.
Previous connection kept
d=# grant connect on database d to joe;
GRANT
d=# \c d joe -- now it should work, and does
You are now connected to database "d" as user "joe".
d=> show role;
role
------
r
(1 row)
Please provide a self-contained script that reproduces
your problem.
regards, tom lane