postgres 8.4 - 授予特权

时间:2015-09-10 21:38:44

标签: sql postgresql postgresql-8.4

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

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

GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA mySchema TO myRole

似乎Postgres8.4不支持 ALL TABLE 关键字。是否有其他方法可以达到相同的效果?

1 个答案:

答案 0 :(得分:0)

根据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');
相关问题