Home > Enterprise >  What permissions do I need to grant a user that wants to view the definition of a stored procedure,
What permissions do I need to grant a user that wants to view the definition of a stored procedure,

Time:07-15

If I want to allow a user to see the definition of a database object that they are not allowed to select or execute how would I do that?

CodePudding user response:

With a few exceptions like pg_authid, all PostgreSQL metadata tables are readable by PUBLIC, that is everybody. In particular, you can get the function definition with

SELECT prosrc
FROM pg_proc
WHERE proname = 'myfunc';

(The source of new-style SQL functions would be stored in parsed form in prosqlbody.)

  • Related