【问题标题】:postgres 8.4 - grant privilegespostgres 8.4 - 授予权限
【发布时间】:2015-12-07 08:09:57
【问题描述】:

如何在Postgres8.4中将某个架构的所有表的权限授予某个角色?

在 Postgres9.x 中,我可以这样做:

GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA mySchema TO myRole

好像 Postgres8.4 不支持 ALL TABLE 关键字。有没有其他方法可以达到相同的结果?

【问题讨论】:

标签: sql postgresql postgresql-8.4


【解决方案1】:

根据this response,您可以使用以下语法:

select 'GRANT ALL ON ' || table_schema || '.' || table_name ||' to my_group;' 
from information_schema.tables 
where 
    table_type = 'BASE TABLE' and 
    table_schema not in ('pg_catalog', 'information_schema');

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-02-10
    • 2019-03-20
    • 2012-07-20
    相关资源
    最近更新 更多