pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: postgresql_tdba@ldbv.bayern.de
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18725: "set role" requires "grant connect on database"
Date: Wed, 27 Nov 2024 13:11:00 -0500
Message-ID: <1895477.1732731060@sss.pgh.pa.us> (raw)
In-Reply-To: <18725-9fd2f5084a8129ad@postgresql.org>
References: <18725-9fd2f5084a8129ad@postgresql.org>

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





view thread (2+ messages)

Message-ID: <1895477.1732731060@sss.pgh.pa.us>
Permalink:  ../1895477.1732731060@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1895477.1732731060@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, postgresql_tdba@ldbv.bayern.de, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #18725: "set role" requires "grant connect on database"
  In-Reply-To: <1895477.1732731060@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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