Postgresql 赋予用户权限和撤销权限
-- 创建用户 CREATE USER thirdqueryuser WITH PASSWORD 'thirduser@#123.'; --赋予登录权限 grant connect on database hncyjjq to thirdqueryuser; --系统表权限清空:防止用户登录上去就能查看 revoke all on pg_class from public; revoke all on pg_tablespace from public; revoke all on pg_user from public; revoke all on pg_roles from public; --赋予schema使用权限 grant usage on schema public to thirdqueryuser; --赋予用户部分表查询权限 GRANT SELECT ON TABLE tb_hncyjjq,tb_hncyjjqgd,tb_hncyjjqgd_hccg,tb_hncyjjqpd1,tb_hncyjjqpd1_hccg,tb_hncyjjqpewg1,tb_hncyjjqpewg1_hccg TO thirdqueryuser; --重新赋予schema权限 grant all on pg_class to public; grant all on pg_tablespace to public; grant all on pg_user to public; grant all on pg_roles to public; --删除用户需先清空权限 revoke all on database db_hncyjjq from cyjjqqueryuser; revoke all on tb_hncyjjq from cyjjqqueryuser; ALTER TABLE tb_hncyjjq OWNER TO jcjg_test; DROP user cyjjqqueryuser