RE: extracting the sql for a function

From: "Charles Clavadetscher" <clavadetscher(at)swisspug(dot)org>
To: "'Paul Tilles'" <paul(dot)tilles(at)noaa(dot)gov>, <pgsql-general(at)postgresql(dot)org>
Subject: RE: extracting the sql for a function
Date: 2018-08-23 18:52:42
Message-ID: 03a101d43b12$7f1f12e0$7d5d38a0$@swisspug.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Melvin Davidson 2018-08-23 19:31:09 Re: extracting the sql for a function
Previous Message Joshua D. Drake 2018-08-23 18:43:54 Re: Upgrade/Downgrade