Re: Scripting GRANT on functions - Mailing list pgsql-sql

From Tom Lane
Subject Re: Scripting GRANT on functions
Date
Msg-id 16713.1128605589@sss.pgh.pa.us
Whole thread Raw
In response to Scripting GRANT on functions  ("Stewart Ben (RBAU/EQS4) *" <Ben.Stewart@au.bosch.com>)
List pgsql-sql
"Stewart Ben (RBAU/EQS4) *" <Ben.Stewart@au.bosch.com> writes:
> Is there any easy way to script granting privileges to a number of
> functions? I've got as far as the following code before realising that
> I'll need to pass in the arguments, and the arguments are stored as OIDs
> in pg_proc.

> Is there any easy way, such as GRANT .... FUNCTION OID 12345?

Coerce the OID to regprocedure to generate a usable name for the
function.

regression=# select oid from pg_proc limit 5;oid
------124212431244  311245
(5 rows)

regression=# select oid::regprocedure from pg_proc limit 5;      oid
------------------boolin(cstring)boolout(boolean)byteain(cstring)byteaout(bytea)charin(cstring)
(5 rows)

regression=#
        regards, tom lane


pgsql-sql by date:

Previous
From: "Russell Simpkins"
Date:
Subject: Re: Scripting GRANT on functions
Next
From: John DeSoi
Date:
Subject: Re: catching errors in function