PGSQL new user authorization cheats

First use the high-level account to find out all the table names

Then Navicat creates a new user

Add permissions, grant permissions, and then find that each table is authorized separately, which is too troublesome

So use the following SQL to get all tables

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;

Then put the table in excel

Then excel batch generation

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

Finally execute the SQL prediction

Guess you like

Origin blog.csdn.net/ccagy/article/details/108241406