Re: grant execute on many functions
| От | Joe Conway |
|---|---|
| Тема | Re: grant execute on many functions |
| Дата | |
| Msg-id | 40E23F72.4000108@joeconway.com обсуждение исходный текст |
| Ответ на | Re: grant execute on many functions (Tom Lane <tgl@sss.pgh.pa.us>) |
| Ответы |
Re: grant execute on many functions
Re: grant execute on many functions Re: grant execute on many functions |
| Список | pgsql-admin |
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
В списке pgsql-admin по дате отправления: