Re: information schema parameter_default implementation
Peter Eisentraut <peter_e@gmx.net>
From: Peter Eisentraut <peter_e@gmx.net>
To: Amit Khandekar <amit.khandekar@enterprisedb.com>
Cc: Ali Dar <ali.munir.dar@gmail.com>, PostgreSQL-development
<pgsql-hackers@postgresql.org>
Date: 2013-10-02T00:59:34Z
Lists: pgsql-hackers
On Wed, 2013-09-18 at 20:13 +0530, Amit Khandekar wrote: > What's the reason behind calling pg_has_role(proowner, 'USAGE') before > calling pg_get_function_arg_default() ? : > > CASE WHEN pg_has_role(proowner, 'USAGE') > THEN pg_get_function_arg_default(p_oid, (ss.x).n) > ELSE NULL END > > There is already a pg_has_role() filter added while fetching the > pg_proc entries : FROM pg_namespace n, pg_proc p > WHERE n.oid = p.pronamespace AND > (pg_has_role(p.proowner, 'USAGE') OR > has_function_privilege(p.oid, 'EXECUTE'))) AS ss > > So the proc oid in pg_get_function_arg_default(p_oid, (ss.x).n) > belongs to a procedure for which the current user has USAGE > privilege. No, the pg_proc entry belongs to a function for which the current user is the owner *or* has EXECUTE privilege. The default, however, is only shown to the owner. This is per SQL standard.