Re: extracting the sql for a function

From: Melvin Davidson <melvin6925(at)gmail(dot)com>
To: Charles Clavadetscher <clavadetscher(at)swisspug(dot)org>
Cc: Paul Tilles <paul(dot)tilles(at)noaa(dot)gov>, "pgsql-general(at)postgresql(dot)org >> PG-General Mailing List" <pgsql-general(at)postgresql(dot)org>
Subject: Re: extracting the sql for a function
Date: 2018-08-23 19:31:09
Message-ID: CANu8Fiyz9pOH3WH8bVG93cVm6a=syyMunk-tyPykxqKrUc0iTQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

*>is there something equivalent for extracting the sql for a function from
the database? *

*Have a look at pg_extractor. It is essentially a pg_dump but with many
more options.*

*https://github.com/omniti-labs/pg_extractor
<https://github.com/omniti-labs/pg_extractor>*

On Thu, Aug 23, 2018 at 2:53 PM Charles Clavadetscher <
clavadetscher(at)swisspug(dot)org> wrote:

> Hello
>
> > -----Original Message-----
> > From: Paul Tilles [mailto:paul(dot)tilles(at)noaa(dot)gov]
> > Sent: Donnerstag, 23. August 2018 19:18
> > To: pgsql-general(at)postgresql(dot)org
> > Subject: extracting the sql for a function
> >
> > Using postgres Version 9.5
> >
> > I can extract the sql for a table using
> >
> > pg_dump -d database_name -s -t table_name -f table_name.sql
> >
> > Is there something equivalent for extracting the sql for a function from
> the database?
> >
> >
> > Paul Tilles
> >
>
> I don't know if there is but you can get the function definition:
>
> SELECT * FROM pg_get_functiondef('functionname'::regproc);
>
> or
>
> SELECT * FROM pg_get_functiondef('functionname(list of parameters data
> types)'::regprocedure);
>
> If you want to export you may use the -t and -o switches.
>
> Regards
> Charles
>
>
>
>

--
*Melvin Davidson*
*Maj. Database & Exploration Specialist*
*Universe Exploration Command – UXC*
Employment by invitation only!

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Nikolay Samokhvalov 2018-08-23 19:40:15 Re: Upgrade/Downgrade
Previous Message Charles Clavadetscher 2018-08-23 18:52:42 RE: extracting the sql for a function