has_database_privilege is true? - Mailing list pgsql-general

From Paul Förster
Subject has_database_privilege is true?
Date
Msg-id 6F69D6E8-6549-4C91-B756-42A27B98C312@gmail.com
Whole thread Raw
Responses Re: has_database_privilege is true?  (Stephen Frost <sfrost@snowman.net>)
List pgsql-general
Hi,

I create a role "test" and it can't (intentionally) login. But why does has_database_privilege() return true if "test"
can'tconnect to the cluster and can't use any database? Is this a bug or am I doing something strange here? Any ideas? 

I'm on PostgreSQL 12.4.

Cheers,
Paul


postgres=# create role "test";
CREATE ROLE
postgres=# \du test
            List of roles
 Role name |  Attributes  | Member of
-----------+--------------+-----------
 test      | Cannot login | {}

postgres=# select has_database_privilege('test', 'postgres', 'connect');
 has_database_privilege
------------------------
 t
(1 row)

postgres=# select has_database_privilege('test', 'db01', 'connect');
 has_database_privilege
------------------------
 t
(1 row)

...

postgres=# select datname from pg_database;
  datname
-----------
 db02
 template0
 template1
 postgres
 db01
(5 rows)




pgsql-general by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: Stored procedure with execute and returning clause
Next
From: Stephen Frost
Date:
Subject: Re: has_database_privilege is true?