pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedScripting only the functions
3+ messages / 3 participants
[nested] [flat]
* Scripting only the functions
@ 2003-10-20 13:04 Kumar <sgnerd@yahoo.com.sg>
0 siblings, 2 replies; 3+ messages in thread
From: Kumar @ 2003-10-20 13:04 UTC (permalink / raw)
To: pgsql-sql
Dear Friends,
I am working with Postgres 7.3.4 on RH Linux server 7.2.
Using pg_dump I could manage to take a script for all the DB objects. But wanted to take the script (DDL) for all the scripts in my database. While I searched I dont find any options in the pg_dump except for script tables only.
Is there a way?
Thanks
Kumar
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Scripting only the functions
@ 2003-10-20 17:21 Josh Berkus <josh@agliodbs.com>
parent: Kumar <sgnerd@yahoo.com.sg>
1 sibling, 0 replies; 3+ messages in thread
From: Josh Berkus @ 2003-10-20 17:21 UTC (permalink / raw)
To: Kumar <sgnerd@yahoo.com.sg>; pgsql-sql
Kumar,
> Using pg_dump I could manage to take a script for all the DB objects. But
> wanted to take the script (DDL) for all the scripts in my database. While I
> searched I dont find any options in the pg_dump except for script tables
> only.
>
> Is there a way?
Currently, no.
--
Josh Berkus
Aglio Database Solutions
San Francisco
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Scripting only the functions
@ 2003-10-20 17:23 Richard Huxton <dev@archonet.com>
parent: Kumar <sgnerd@yahoo.com.sg>
1 sibling, 0 replies; 3+ messages in thread
From: Richard Huxton @ 2003-10-20 17:23 UTC (permalink / raw)
To: Kumar <sgnerd@yahoo.com.sg>; pgsql-sql
On Monday 20 October 2003 14:04, Kumar wrote:
> Dear Friends,
>
> I am working with Postgres 7.3.4 on RH Linux server 7.2.
>
> Using pg_dump I could manage to take a script for all the DB objects. But
> wanted to take the script (DDL) for all the scripts in my database. While I
> searched I dont find any options in the pg_dump except for script tables
> only.
That'll be because there isn't one (as far as I know).
You could pipe the output of your pg_dump schema through a small perl script
something like:
#!/usr/bin/perl -w
use strict;
my ($line, $in_func);
while ($line = <>) {
if ($line =~ /^CREATE.+FUNCTION/) { $in_func = 1; }
if ($in_func) { print $line; }
if ($line =~ /^\s+LANGUAGE\s+\w+;$/) {
$in_func = 0;
print "\n";
}
}
That should do it, although it will fail if you have a line in your function
starting with "LANGUAGE" (doesn't seem likely to me).
The other options you could use are:
1. To write your own function-dumping script (use psql -E then \df+ to see how
to get the function source).
2. Use pgadmin if there aren't too many functions to process, and do it by
hand.
--
Richard Huxton
Archonet Ltd
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2003-10-20 17:23 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-10-20 13:04 Scripting only the functions Kumar <sgnerd@yahoo.com.sg>
2003-10-20 17:21 ` Josh Berkus <josh@agliodbs.com>
2003-10-20 17:23 ` Richard Huxton <dev@archonet.com>
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