From: | Paul Förster <paul(dot)foerster(at)gmail(dot)com> |
---|---|
To: | Postgres General <pgsql-general(at)postgresql(dot)org> |
Subject: | has_database_privilege is true? |
Date: | 2020-08-23 13:10:35 |
Message-ID: | 6F69D6E8-6549-4C91-B756-42A27B98C312@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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'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)
From | Date | Subject | |
---|---|---|---|
Next Message | Stephen Frost | 2020-08-23 14:28:34 | Re: has_database_privilege is true? |
Previous Message | Pavel Stehule | 2020-08-23 12:47:37 | Re: Stored procedure with execute and returning clause |