Hi,

I create a role "test" and it can't (intentionally) login. But why does 
has_database_privilege() return true if "test" can't connect 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)



Reply via email to