开发者

How to check permissions to functions under psql console

开发者 https://www.devze.com 2023-01-02 22:31 出处:网络
Could you tell me please how to check permission开发者_Go百科s to functions with psql console but without being overwhelmed with source code and descirption (like when using \\df+).For a simpler query

Could you tell me please how to check permission开发者_Go百科s to functions with psql console but without being overwhelmed with source code and descirption (like when using \df+).


For a simpler query, use:

SELECT proacl FROM pg_proc WHERE proname='FUNCTION-NAME';

The results is like:

                           proacl                       
----------------------------------------------------
 {=X/postgres,postgres=X/postgres,test1=X/postgres}
(1 row)

which shows that test1 user also has access to this function.

For more details, see the discussion on psql's mailing list: psql missing feature: show permissions for functions.


You could query the system tables:

SELECT proname, rolname
  FROM pg_proc pr,
       pg_type tp,
       pg_authid id
 WHERE proowner = id.oid
   AND tp.oid = pr.prorettype
   AND pr.proisagg = FALSE
   AND tp.typname <> 'trigger'
   AND pr.pronamespace IN (
       SELECT oid
         FROM pg_namespace
        WHERE nspname NOT LIKE 'pg_%'
          AND nspname != 'information_schema'
);
0

精彩评论

暂无评论...
验证码 换一张
取 消