【问题标题】:Revoke privilege "create table" from public schema but not from custom made schema从公共架构中撤消特权“创建表”,但不是从定制架构中撤消
【发布时间】:2015-10-27 21:49:48
【问题描述】:

我正在尝试创建一个只能在 mydb_schema 中使用“SELECT”的帐户。

我能够从特定角色撤消在我的数据库 (mydb) 中的公共架构中创建表,但我无法撤消在架构 (mydb_schema) 中创建表的创建角色 (user_role)到。

有人可以帮忙吗?我错过了什么?

以下是我作为用户 postgres 和架构所有者使用的命令。最后,我还通过使用 noinherit 作为绝望的测试来更改 postgres 帐户。没有结果。

\c mydb
 mydb=# create role user_account
 mydb=# alter role user_account login noinherit;
 mydb=# alter role user_account set search_path = 'mydb_schema';
 ##Up until this point I don't have SELECT pivileges but I can create a table within mydb_schema only and not in public.
 mydb=# grant select on all tables in schema mydb_schema to user_account;
 mydb=# revoke CREATE on SCHEMA public from public;

这些是我的数据库:

List of databases
Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges   |  Size   | Tablespace |                Description
--------------------------------------------------------------------------
postgres  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |                       | 6820 kB | pg_default | default administrative connection database
mydb      | seeker   | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =Tc/seeker           +| 3465 MB | pg_default |
                                                              seeker=CTc/seeker 

这些是我的架构:

                          List of schemas
  Name      |  Owner   |  Access privileges   |      Description
----------------+----------+----------------------+------------------------
 public         | postgres | postgres=UC/postgres | standard public schema
 mydb_schema    | seeker   | seeker=UC/seeker    +|
                |          | =UC/seeker           |

【问题讨论】:

    标签: postgresql-9.4


    【解决方案1】:

    找到解决方案here in dba.stackexchange

    alter role servers_admin set default_transaction_read_only = 'ON';

    【讨论】:

      猜你喜欢
      • 2017-08-14
      • 1970-01-01
      • 2011-06-08
      • 2010-11-01
      • 2015-05-31
      • 1970-01-01
      • 1970-01-01
      • 2010-09-25
      • 2017-07-26
      相关资源
      最近更新 更多