Re: Scripting GRANT on functions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Stewart Ben (RBAU/EQS4) *" <Ben(dot)Stewart(at)au(dot)bosch(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Scripting GRANT on functions
Date: 2005-10-06 13:33:09
Message-ID: 16713.1128605589@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"Stewart Ben (RBAU/EQS4) *" <Ben(dot)Stewart(at)au(dot)bosch(dot)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
------
1242
1243
1244
31
1245
(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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message John DeSoi 2005-10-06 13:51:24 Re: catching errors in function
Previous Message Russell Simpkins 2005-10-06 13:06:29 Re: Scripting GRANT on functions