I ended up here because my DB user saw only a few tables and not the newer ones. If this is your case, this has helped me.
-
Grant privileges to all existing tables:
复制代码1
2GRANT SELECT ON ALL TABLES IN SCHEMA public TO user;
-
Grant privileges to all new tables to be created in future (via default privileges):
复制代码1
2ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO user;
-
You can also double-check that all tables are granted correctly.
-
Count all existing tables:
复制代码1
2
3
4
5SELECT COUNT(*) FROM pg_catalog.pg_tables WHERE schemaname != 'pg_catalog' AND schemaname != 'information_schema';
-
Count all tables the user has access to:
复制代码1
2
3
4SELECT COUNT(*) FROM information_schema.role_table_grants WHERE grantee = 'user';
The count of last two queries must be the same.
-
最后
以上就是无限彩虹最近收集整理的关于postgresql 授权的全部内容,更多相关postgresql内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复