X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id BEB5CD1B4EC for ; Mon, 20 Oct 2003 17:23:49 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 69738-08 for ; Mon, 20 Oct 2003 14:23:18 -0300 (ADT) Received: from anchor-post-30.mail.demon.net (anchor-post-30.mail.demon.net [194.217.242.88]) by svr1.postgresql.org (Postfix) with ESMTP id 9C85ED1B4F6 for ; Mon, 20 Oct 2003 14:23:17 -0300 (ADT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-30.mail.demon.net with esmtp (Exim 3.35 #1) id 1ABdkS-00053c-0U; Mon, 20 Oct 2003 18:23:17 +0100 Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id 0C23B182E6; Mon, 20 Oct 2003 18:23:16 +0100 (BST) Received: from client17.archonet.com (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 5782E182C2; Mon, 20 Oct 2003 18:23:15 +0100 (BST) From: Richard Huxton To: "Kumar" , "psql" Subject: Re: Scripting only the functions Date: Mon, 20 Oct 2003 18:23:14 +0100 User-Agent: KMail/1.5 References: <00ff01c3970a$c1c3d610$7502a8c0@hdsc.com> In-Reply-To: <00ff01c3970a$c1c3d610$7502a8c0@hdsc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200310201823.14910.dev@archonet.com> X-Virus-Scanned: by AMaViS snapshot-20020531 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/244 X-Sequence-Number: 15644 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