From: | Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> |
---|---|
To: | Holger Jakobs <holger(at)jakobs(dot)com>, pgsql-admin(at)lists(dot)postgresql(dot)org |
Subject: | Re: postgres (superuser) cannot connect to database |
Date: | 2022-11-23 14:14:01 |
Message-ID: | e0b3128f9c5b6a4f3d7a0274b38a952632821fe0.camel@cybertec.at |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
On Wed, 2022-11-23 at 13:41 +0100, Holger Jakobs wrote:
> How come a user who has issued "set role to postgres", so that the
> current user is postgres, cannot connect to a database?
>
> Are superuser rights not sufficient?
>
> student(at)[local]:5434//~:=# \c einkauf
> Verbindung zum Server auf Socket »/var/run/postgresql/.s.PGSQL.5434«
> fehlgeschlagen: FATAL: keine Berechtigung für Datenbank »einkauf«
> DETAIL: Benutzer hat das CONNECT-Privileg nicht.
> Vorherige Verbindung wurde behalten
> student(at)[local]:5434//~:=# grant connect on database einkauf to postgres;
> GRANT
> student(at)[local]:5434//~:=# \c einkauf
> Sie sind jetzt verbunden mit der Datenbank »einkauf« als Benutzer »student«.
> student(at)[local]:5434//einkauf:=>
>
> Who can explain this? It's version 15 I'm using for the first time,
> haven't checked with oder versions.
PostgreSQL doesn't use the current role for the new connection, but the
role you used to authenticate originally.
See \conninfo or "SELECT session_user;" to see that role.
Yours,
Laurenz Albe
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2022-11-23 14:18:31 | Re: postgres (superuser) cannot connect to database |
Previous Message | Holger Jakobs | 2022-11-23 12:41:39 | postgres (superuser) cannot connect to database |