Re: extracting the sql for a function

Поиск
Список
Период
Сортировка
От Melvin Davidson
Тема Re: extracting the sql for a function
Дата
Msg-id CANu8Fiyz9pOH3WH8bVG93cVm6a=syyMunk-tyPykxqKrUc0iTQ@mail.gmail.com
обсуждение исходный текст
Ответ на RE: extracting the sql for a function  ("Charles Clavadetscher" <clavadetscher@swisspug.org>)
Список 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.


On Thu, Aug 23, 2018 at 2:53 PM Charles Clavadetscher <clavadetscher@swisspug.org> wrote:
Hello

> -----Original Message-----
> From: Paul Tilles [mailto:paul.tilles@noaa.gov]
> Sent: Donnerstag, 23. August 2018 19:18
> To: pgsql-general@postgresql.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!

В списке pgsql-general по дате отправления:

Предыдущее
От: "Charles Clavadetscher"
Дата:
Сообщение: RE: extracting the sql for a function
Следующее
От: Nikolay Samokhvalov
Дата:
Сообщение: Re: Upgrade/Downgrade