我是靠谱客的博主 无限彩虹,最近开发中收集的这篇文章主要介绍postgresql 授权,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

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.

  1. Grant privileges to all existing tables:

    GRANT SELECT ON ALL TABLES IN SCHEMA public TO user;
    
  2. Grant privileges to all new tables to be created in future (via default privileges):

    ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO user;
    
  3. You can also double-check that all tables are granted correctly.

    • Count all existing tables:

      SELECT COUNT(*)
      FROM pg_catalog.pg_tables
      WHERE schemaname != 'pg_catalog' AND
            schemaname != 'information_schema';
      
    • Count all tables the user has access to:

      SELECT COUNT(*)
      FROM information_schema.role_table_grants
      WHERE grantee = 'user';
      

    The count of last two queries must be the same.

最后

以上就是无限彩虹为你收集整理的postgresql 授权的全部内容,希望文章能够帮你解决postgresql 授权所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(64)

评论列表共有 0 条评论

立即
投稿
返回
顶部