0
点赞
收藏
分享

微信扫一扫

PGSQL新增用户授权的秘籍

yeamy 2023-01-09 阅读 72


首先用高级权限账号查出所有的表名字

然后navicat新建用户

新增权限,授予权限,然后发现每个表单独授权,太麻烦

于是用下面的SQL获取所有表

select distinct
col.table_name as 表名
from
information_schema.columns col left join pg_description des on
col.table_name::regclass = des.objoid
and col.ordinal_position = des.objsubid
where
table_schema = 'public'
--and table_name = 'ods_des_users'
order by
col.table_name;

然后把表放到excel里面去

然后excel批量生成

GRANT Select ON TABLE "public"."table_name" TO "账号名称" WITH GRANT OPTION;

最后执行SQL预计即可

举报

相关推荐

0 条评论