1

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?

  • must be the owner of the object or superuser. alternative execute over a function with that show the info compiled with a super user and SECURITY DEFINER to be executed by the low access user. – Frank N Stein Jul 14 '22 at 18:22
  • What makes you think they can't now? This information comes from the system catalogs and anyone can look at them. Try `select * from pg_proc`. – Adrian Klaver Jul 14 '22 at 18:24

1 Answers1

1

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.)

Laurenz Albe
  • 209,280
  • 17
  • 206
  • 263
  • Can you please help me one this: https://stackoverflow.com/questions/72996231/get-maximum-number-of-job-slaves-per-instance-that-can-be-created-for-the-execut – MAK Jul 15 '22 at 15:58