Re: grant execute on many functions

From: Joe Conway <mail(at)joeconway(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Jean-Denis Giguere <jdenisgiguere(at)fastmail(dot)fm>, pgsql-admin(at)postgresql(dot)org
Subject: Re: grant execute on many functions
Date: 2004-06-30 04:20:02
Message-ID: 40E23F72.4000108@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-hackers

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

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Tom Lane 2004-06-30 04:26:17 Re: grant execute on many functions
Previous Message Tom Lane 2004-06-30 03:45:14 Re: grant execute on many functions

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2004-06-30 04:26:17 Re: grant execute on many functions
Previous Message Tom Lane 2004-06-30 03:45:14 Re: grant execute on many functions