在PostgreSQL中将来的表上授予特权?

编程入门 行业动态 更新时间:2024-10-26 21:24:29
本文介绍了在PostgreSQL中将来的表上授予特权?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在运行PostgreSQL 9.3.1。我有 test 数据库和 backup 用户,该用户用于备份数据库。向所有当前表授予特权没有问题,但是每次将新表添加到架构时,我都必须授予特权。

I am running PostgreSQL 9.3.1. I have test database and backup user which is used to backup the database. I have no problems with granting privileges to all current tables, but I have to grant privileges each time the new table is added to schema.

createdb test psql test test=# create table foo(); CREATE TABLE test=# grant all on all tables in schema public to backup; GRANT test=# create table bar(); CREATE TABLE psql -U backup test test=> select * from foo; test=> select * from bar; ERROR: permission denied for relation bar

的权限被拒绝是否有可能授予对表的访问权限

Is it possible to grant access to tables which will be created in future without making user owner of the table?

推荐答案

看来解决方案是更改 backup 用户:

It looks like the solution is to alter default privileges for backup user:

alter default privileges in schema public grant all on tables to backup; alter default privileges in schema public grant all on sequences to backup;

更多推荐

在PostgreSQL中将来的表上授予特权?

本文发布于:2023-10-14 12:14:11,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1491037.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:特权   表上   将来   PostgreSQL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!