Re: get source of udf

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Peter Kroon <plakroon(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: get source of udf
Date: 2012-11-20 10:40:00
Message-ID: CAFj8pRDF92ToU=pZd0nuJD9gXSosxbTHmrWdsc6Z55Ep3bL41A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello

postgres=# select pg_get_functiondef('fx'::regproc);
pg_get_functiondef
--------------------------------------------------
CREATE OR REPLACE FUNCTION public.fx(_m integer)+
RETURNS void +
LANGUAGE plpgsql +
AS $function$ +
declare m double precision = 10; +
n double precision = 20022.222; +
r double precision; +
begin +
for i in 1.._m +
loop +
r := m * n; +
end loop; +
end; +
$function$ +

(1 row)

regards

Pavel Stehule

2012/11/20 Peter Kroon <plakroon(at)gmail(dot)com>:
> Hi list,
>
> I would like to get the source of a udf.
> In mssql I run this query:
> SELECT OBJECT_DEFINITION(OBJECT_ID) FROM sys.objects WHERE
> name='function_name';
> And I get the entire source of the function.
>
> How must I do this in PostgreSQL?
>
> Thanks,
> Peter

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Harry 2012-11-20 11:54:21 Performance Testing Metrics
Previous Message 张柏年 2012-11-20 10:09:21 flush buffer after connection disllowed