pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Stewart Ben (RBAU/EQS4) * <Ben.Stewart@au.bosch.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Scripting GRANT on functions
Date: Thu, 06 Oct 2005 09:33:09 -0400
Message-ID: <16713.1128605589@sss.pgh.pa.us> (raw)
In-Reply-To: <E253BDD7F008244585AEE87AF8F0224F116C7AA6@cl-mail01.au.bosch.com>
References: <E253BDD7F008244585AEE87AF8F0224F116C7AA6@cl-mail01.au.bosch.com>

"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
------
 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



view thread (3+ messages)

Message-ID: <16713.1128605589@sss.pgh.pa.us>
Permalink:  ../16713.1128605589@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/16713.1128605589@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, Ben.Stewart@au.bosch.com
  Subject: Re: Scripting GRANT on functions
  In-Reply-To: <16713.1128605589@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox