授予每次创建新表时方案中的每个表的权限。

huangapple go评论59阅读模式
英文:

Grant rights to every table in a scheme every time a new table is created

问题

问题是当创建新表时,模式的用户无法访问它。
我想创建一个触发器,每当创建新表时都会启动。
每个用户都应该有对新表的读取权限。

我尝试了一些触发事件,但它们没有起作用...也许你可以帮助。

英文:

The problem is when new table is created, the user of the schema dont have access to it.
I want to create a trigger which is started everytime when a new table is being created.
Every user should have read rights to the new table.

I tried some trigger events but they didnt worked.. maybe you can help.

答案1

得分: 0

ALTER DEFAULT PRIVILEGES IN SCHEMA your_schema
GRANT SELECT ON TABLES TO your_user;

This role must have usage permissions on the schema as well.

英文:

Set default permissions for the new tables created in the future:

ALTER DEFAULT PRIVILEGES IN SCHEMA your_schema 
GRANT SELECT ON TABLES TO your_user;

This role must have usage permissions on the schema as well.

huangapple
  • 本文由 发表于 2023年6月27日 18:27:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/76563931.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定