pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Dump SQL DDL of all functions in DB
3+ messages / 3 participants
[nested] [flat]

* Dump SQL DDL of all functions in DB
@ 2011-08-03 23:35  Bradley Holbrook, Servillian Technology <bholbrook@servillian.com>
  0 siblings, 2 replies; 3+ messages in thread

From: Bradley Holbrook, Servillian Technology @ 2011-08-03 23:35 UTC (permalink / raw)
  To: pgsql-admin

Anyone know how to dump the DDL of every function in a schema into one file?

 

Essentially, I'd like to do something like:

 

'functions ddl dump cmd' public functions.sql

 

Bradley A Holbrook

Sr. Web Developer

Servillian Technology Ltd

 

 <http://www.servillian.com/; http://www.servillian.com

 <mailto:bholbrook@servillian.com> bholbrook@servillian.com

 <mailto:bholbrook@telus.blackberry.net> bholbrook@telus.blackberry.net

Cell:       (250) 309 - 7408

Office: (250) 260 - 4351 ext. 13

 

*************************************

For up to the minute news, support notifications and other pertinant
information regarding your website or related services, you can use the
following resources:

 

 <http://twitter.com/#!/Servillian; Twitter |
<http://www.facebook.com/pages/Servillian-Technology-Ltd/144527612254727;
Facebook |  <http://support.servillian.ca/; Support Website

 

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Dump SQL DDL of all functions in DB
@ 2011-08-09 15:25  Joe Conway <mail@joeconway.com>
  parent: Bradley Holbrook, Servillian Technology <bholbrook@servillian.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Joe Conway @ 2011-08-09 15:25 UTC (permalink / raw)
  To: Bradley Holbrook, Servillian Technology <bholbrook@servillian.com>; +Cc: pgsql-admin

On 08/03/2011 04:35 PM, Bradley Holbrook, Servillian Technology wrote:
> Anyone know how to dump the DDL of every function in a schema into one file?
> 
> Essentially, I’d like to do something like:
> 
> ‘functions ddl dump cmd’ public functions.sql

The easiest way is probably to do a schema-only dump and then edit the
result to eliminate everything you don't want. E.g.:

  pg_dump --schema-only --schema=foobar test

Note that "--schema-only" means object definitions without data whereas
"--schema=foobar" is saying to only consider objects in the schema
called foobar. The work "schema" here has two different meanings.

HTH,

Joe


-- 
Joe Conway
credativ LLC: http://www.credativ.us
Linux, PostgreSQL, and general Open Source
Training, Service, Consulting, & 24x7 Support



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Dump SQL DDL of all functions in DB
@ 2011-08-09 15:55  Jerry Sievers <gsievers19@comcast.net>
  parent: Bradley Holbrook, Servillian Technology <bholbrook@servillian.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Jerry Sievers @ 2011-08-09 15:55 UTC (permalink / raw)
  To: Bradley Holbrook\, Servillian Technology <bholbrook@servillian.com>; +Cc: pgsql-admin

"Bradley Holbrook, Servillian Technology" <bholbrook@servillian.com>
writes:

> Anyone know how to dump the DDL of every function in a schema into one file?
>
> Essentially, Iùd like to do something like:
>
> øfunctions ddl dump cmdù public functions.sql

select pg_get_functiondef(p.oid) || ';'
from pg_proc p
join pg_namespace n on p.pronamespace = n.oid
where n.nspname = 'public'
;
psql -Atq -f...

HTH

> Bradley A Holbrook
>
> Sr. Web Developer
>
> Servillian Technology Ltd
>
> http://www.servillian.com
>
> bholbrook@servillian.com
>
> bholbrook@telus.blackberry.net
>
> Cell:       (250) 309 ó 7408
>
> Office: (250) 260 ó 4351 ext. 13
>
> *************************************
>
> For up to the minute news, support notifications and other pertinant information regarding your website or related
> services, you can use the following resources:
>
> Twitter | Facebook | Support Website
>

-- 
Jerry Sievers
Postgres DBA/Development Consulting
e: postgres.consulting@comcast.net
p: 305.321.1144



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2011-08-09 15:55 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-08-03 23:35 Dump SQL DDL of all functions in DB Bradley Holbrook, Servillian Technology <bholbrook@servillian.com>
2011-08-09 15:25 ` Joe Conway <mail@joeconway.com>
2011-08-09 15:55 ` Jerry Sievers <gsievers19@comcast.net>

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