向用户授予在Postgresql中创建的任何新表的权限 [英] Grant permissions to user for any new tables created in postgresql

查看:1860
本文介绍了向用户授予在Postgresql中创建的任何新表的权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前,我正在使用它来授予权限:

Currently I am using this to grant permissions:

grant select on all tables in schema public to <user_name>;

alter default privileges in schema public grant select on tables to <user_name>;

根据文档,第二条语句应该已经解决了该问题。但是,当将新表添加到公共模式时,它不会自动授予user_name权限。

According to the documentation, the second statement should have resolved the problem. It does not however auto grant permissions to user_name when a new table is added to the public schema.

我正在使用此用户(用户名)将数据复制到另一个数据库中。

I am using this user (user_name) to copy data over to another database.

推荐答案

找到了答案。在文档的这一行中。

Found the answer. It is in this line in the documentation.

您只能更改将由您自己或您所隶属角色创建的对象的默认特权。

"You can change default privileges only for objects that will be created by yourself or by roles that you are a member of."

我使用的是与创建表的用户不同的默认用户特权。

I was using alter default privileges from a different user than the one creating the tables.

这篇关于向用户授予在Postgresql中创建的任何新表的权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆