From: Joe Conway <mail@joeconway.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Jean-Denis Giguere <jdenisgiguere@fastmail.fm>
Cc: pgsql-admin@postgresql.org
Subject: Re: grant execute on many functions
Date: Tue, 29 Jun 2004 21:20:02 -0700
Message-ID: <40E23F72.4000108@joeconway.com> (raw)
In-Reply-To: <3318.1088567114@sss.pgh.pa.us>
References: <40E1E1A9.8080207@fastmail.fm>
<40E1ECEF.5090007@joeconway.com>
<3318.1088567114@sss.pgh.pa.us>
Tom Lane wrote:
> Also, casting the function's OID to regprocedure may be useful.
> Random example:
>
> regression=# select 1142::regprocedure;
> regprocedure
> ------------------------
> date_mii(date,integer)
> (1 row)
That's even better -- I tried regproc, but forgot about regprocedure. I
think the problem will be, though, that the output of the reg* datatypes
is not castable to text, and therefore cannot be used to build a dynamic
sql statement.
select 'GRANT EXECUTE ON ' || 1142::regprocedure;
ERROR: array value must start with "{" or dimension information
But with the help of plpgsql:
create or replace function regprocedure2text(regprocedure)
returns text as '
begin
return $1;
end;
' language plpgsql;
CREATE FUNCTION
select 'GRANT EXECUTE ON ' || regprocedure2text(1142::regprocedure);
?column?
-----------------------------------------
GRANT EXECUTE ON date_mii(date,integer)
(1 row)
Joe
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: mail@joeconway.com, tgl@sss.pgh.pa.us, jdenisgiguere@fastmail.fm
Subject: Re: grant execute on many functions
In-Reply-To: <40E23F72.4000108@joeconway.com>
References: <40E1E1A9.8080207@fastmail.fm> <40E1ECEF.5090007@joeconway.com> <3318.1088567114@sss.pgh.pa.us> <40E23F72.4000108@joeconway.com>
* 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