pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Charles Clavadetscher <clavadetscher@swisspug.org>
To: 'Paul Tilles' <paul.tilles@noaa.gov>
To: pgsql-general@postgresql.org
Subject: RE: extracting the sql for a function
Date: Thu, 23 Aug 2018 20:52:42 +0200
Message-ID: <03a101d43b12$7f1f12e0$7d5d38a0$@swisspug.org> (raw)
In-Reply-To: <ee1a7fbd-a91d-7166-85b2-9fa9e68b0df6@noaa.gov>
References: <ee1a7fbd-a91d-7166-85b2-9fa9e68b0df6@noaa.gov>

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






view thread (4+ messages)  latest in thread

Message-ID: <03a101d43b12$7f1f12e0$7d5d38a0$@swisspug.org>
Permalink:  ../03a101d43b12$7f1f12e0$7d5d38a0$@swisspug.org/
Also on:    postgresql.org/message-id/03a101d43b12$7f1f12e0$7d5d38a0$@swisspug.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: clavadetscher@swisspug.org, paul.tilles@noaa.gov
  Subject: Re: extracting the sql for a function
  In-Reply-To: <03a101d43b12$7f1f12e0$7d5d38a0$@swisspug.org>
  References: <ee1a7fbd-a91d-7166-85b2-9fa9e68b0df6@noaa.gov> <03a101d43b12$7f1f12e0$7d5d38a0$@swisspug.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox