What is the command to find script of a existing function in postgresql?

postgresql

Solution

If you are using psql (the commandline interface) you can use `\df+` as tobixen has already stated (and which is clearly documented in the manual).

If you need to do this from within a SQL query, take a look a the system information functions. You are looking for `pg_get_functiondef()`

select pg_get_functiondef(oid)
from pg_proc
where proname = 'your_function';

If you are dealing with overloaded functions having a different number of parameters, you need to include the parameter signature into the name:

select pg_get_functiondef('public.foo(int)'::regprocedure);
select pg_get_functiondef('public.foo(int,int)'::regprocedure);

will retrieve the overloaded versions of the function `foo` (one version with a single int parameter, the other version with two int parameters).

Problem

As we are using sp_helptext [procedure name] to get the SP script in Sqlserver, I need the command that i can use to retrieve a function script from postgresql. Please help....

Original source

Related problems