> Thanks everyone! I looked around the user-defined functions section of the > documentation, but there wasn't any mention of this. I'm sure others would > find it useful if it were included, or at least referenced to.
Just for info:
wait for the upcoming new release 8.4, it contains a function called pg_get_functiondef(). Example:
test=# create or replace function foo(in a int) returns int as $$begin return a*10; end; $$language plpgsql; CREATE FUNCTION test=# select pg_get_functiondef('foo'::regproc); pg_get_functiondef -------------------------------------------------- CREATE OR REPLACE FUNCTION public.foo(a integer) RETURNS integer LANGUAGE plpgsql AS $function$begin return a*10; end; $function$