我正在尝试创建一个 postgresql 用户,该用户可以选择但不能在数据库上创建或删除、插入等,但我终生无法弄清楚如何阻止用户创建自己的表。
到目前为止我所做的:
create database test;
create role readonly;
alter role readonly with login;
alter role readonly with encrypted password 'test';
revoke all on schema public from public;
revoke all on schema public from readonly;
revoke all on database test from public;
revoke all on database test from readonly;
grant connect on database test to readonly;
Run Code Online (Sandbox Code Playgroud)
然而,当我以只读身份登录到数据库时,我仍然可以不受惩罚地创建表。我错过了什么?