Re: [GENERAL] Generating GRANT/REVOKE on functions from catalog

2009-08-05 Thread Tom Lane
Doug Gorley writes: > Perfect, I'm using the following function: > create or replace function fn_sig(p_oid oid) returns text > as $$ > begin > return p_oid::regprocedure; > end; > $$ language plpgsql; > In the following query: > select > pg_namespace.nspname || > '.' || > fn_sig(pg_p

Re: [GENERAL] Generating GRANT/REVOKE on functions from catalog

2009-08-05 Thread Doug Gorley
Perfect, I'm using the following function: create or replace function fn_sig(p_oid oid) returns text as $$ begin return p_oid::regprocedure; end; $$ language plpgsql; In the following query: select pg_namespace.nspname || '.' || fn_sig(pg_proc.oid) from pg_proc inner join pg_name

Re: [GENERAL] Generating GRANT/REVOKE on functions from catalog

2009-08-04 Thread Tom Lane
Doug Gorley writes: > That looks like exactly what I want. Is there an easy way to cast that > to a string so that I can concatenate it into a GRANT statement? Well, since 8.3 you just cast it to a string ;-) In older versions I'd suggest a plpgsql wrapper function. plpgsql has always been ve

Re: [GENERAL] Generating GRANT/REVOKE on functions from catalog

2009-08-04 Thread Doug Gorley
That looks like exactly what I want. Is there an easy way to cast that to a string so that I can concatenate it into a GRANT statement? *Doug Gorley* | doug.gor...@gmail.com Tom Lane wrote:

Re: [GENERAL] Generating GRANT/REVOKE on functions from catalog

2009-08-04 Thread Tom Lane
Doug Gorley writes: > The statement I need to generate is: > revoke all on function public.add(integer, integer) from someuser; > I'm attempting to use the pg_proc table in the system catalogs, and I'm > good up to the point where I need the parameter types. Can anyone give > me a hand with t

[GENERAL] Generating GRANT/REVOKE on functions from catalog

2009-08-04 Thread Doug Gorley
I am attempting to script the generation of grant/revoke statements for a database, and I'm having some trouble when it comes to functions. consider the following function: create function add(a integer, b integer) returns integer as $$ select $1 + $2; $$ language SQL; The statement I need to