最近2018中文字幕在日韩欧美国产成人片_国产日韩精品一区二区在线_在线观看成年美女黄网色视频_国产精品一区三区五区_国产精彩刺激乱对白_看黄色黄大色黄片免费_人人超碰自拍cao_国产高清av在线_亚洲精品电影av_日韩美女尤物视频网站

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
Case:一個(gè)read-only角色對某個(gè)schema下的新建的表,無需單獨(dú)授權(quán),直接擁有只讀權(quán)

Case: 一個(gè)read-only 角色對某個(gè)schema下的新建的表,無需單獨(dú)授權(quán),直接擁有只讀權(quán)限

創(chuàng)新互聯(lián)-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設(shè)、高性價(jià)比關(guān)嶺網(wǎng)站開發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫,直接使用。一站式關(guān)嶺網(wǎng)站制作公司更省心,省錢,快速模板網(wǎng)站建設(shè)找我們,業(yè)務(wù)覆蓋關(guān)嶺地區(qū)。費(fèi)用合理售后完善,十余年實(shí)體公司更值得信賴。

首先,你要知道PostgreSQL默認(rèn)schema下新建的表,對于一個(gè)普通用戶不會(huì)有select的權(quán)限的,所以我需要修改PostgreSQl默認(rèn)的權(quán)限,把select提前賦予普通用戶,需要使用到alter default privileges這個(gè)命令


Session1 (user:postgres):

#psql

create role role1 password '123456' login;

create schema schema1;

grant usage on schema schema1 to role1;

testdb=# \dn+ schema1;

                     List of schemas

  Name   |  Owner   |  Access privileges   | Description

---------+----------+----------------------+-------------

schema1 | postgres | postgres=UC/postgres+|

         |          | role1=U/postgres     |


alter default privileges in schema schema1 grant select on tables to role1;


testdb=# \ddp+

           Default access privileges

  Owner   | Schema  | Type  | Access privileges

----------+---------+-------+-------------------

postgres | schema1 | table | role1=r/postgres


create table schema1.t1(c1 int,c2 varchar(10));

insert into schema1.t1 values(1,'aaa');


testdb=# \dp+

                                 Access privileges

Schema  | Name | Type  |     Access privileges     | Column privileges | Policies

---------+------+-------+---------------------------+-------------------+----------

schema1 | t1   | table | postgres=arwdDxt/postgres+|                   |

         |      |       | role1=r/postgres          |                   |


Session2 read_only:


#psql -h 172.16.101.54 -p 5432 testdb role1

testdb=> select * from schema1.t1;

c1 | c2  

----+-----

  1 | aaa

(1 row)


名稱欄目:Case:一個(gè)read-only角色對某個(gè)schema下的新建的表,無需單獨(dú)授權(quán),直接擁有只讀權(quán)
文章地址:http://fisionsoft.com.cn/article/iidedg.html