\ l何时列出访问特权,什么时候不列出?\ l列出的访问权限可以在授予并撤消后更改:
$ createuser -EP my_readonly
$ psql development
development=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------------------------+----------+----------+-------------+-------------+-----------------------
development | vagrant | UTF8 | en_GB.UTF-8 | en_GB.UTF-8 |
...
development=# grant usage on schema public to my_readonly;
development=# grant connect on database development to my_readonly;
development=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------------------------+----------+----------+-------------+-------------+----------------------------
development | vagrant | UTF8 | en_GB.UTF-8 | en_GB.UTF-8 | =Tc/vagrant +
| | | | | vagrant=CTc/vagrant +
| | | | | my_readonly=c/vagrant
...
development=# revoke connect on database development from my_readonly;
REVOKE
development=# revoke usage on schema public from my_readonly;
REVOKE
development=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------------------------+----------+----------+-------------+-------------+-----------------------
development | vagrant | UTF8 | en_GB.UTF-8 | en_GB.UTF-8 | =Tc/vagrant +
| | | | | vagrant=CTc/vagrant
这是为什么?什么状态改变了?我相信my_readonly用户的连接能力在整个psql会话中没有改变(因为我猜PUBLIC角色具有连接权限),但显然有所改变:那是什么?
附带问题:我如何明确询问postgres PUBLIC实际上是否具有连接特权(它们可能已被撤销-请参阅为什么新用户可以从任何表中选择?)?