From sgnerd@yahoo.com.sg Mon Oct 20 13:00:18 2003 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 7C196D1B4E3 for ; Mon, 20 Oct 2003 13:00:18 +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 16695-05 for ; Mon, 20 Oct 2003 09:59:49 -0300 (ADT) Received: from smtp101.mail.sc5.yahoo.com (smtp101.mail.sc5.yahoo.com [216.136.174.139]) by svr1.postgresql.org (Postfix) with SMTP id E372ED1B509 for ; Mon, 20 Oct 2003 09:59:45 -0300 (ADT) Received: from ptil-138-190-chn.primus-india.net (HELO IVESIA67) (sgnerd@203.196.190.138 with login) by smtp.mail.vip.sc5.yahoo.com with SMTP; 20 Oct 2003 12:59:49 -0000 Message-ID: <00ff01c3970a$c1c3d610$7502a8c0@hdsc.com> Reply-To: "Kumar" From: "Kumar" To: "psql" Subject: Scripting only the functions Date: Mon, 20 Oct 2003 18:34:48 +0530 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_00FC_01C39738.D7B67E90" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.7 tagged_above=0.0 required=5.0 tests=HTML_40_50 X-Spam-Level: X-Archive-Number: 200310/231 X-Sequence-Number: 15631 This is a multi-part message in MIME format. ------=_NextPart_000_00FC_01C39738.D7B67E90 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable 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 w= anted 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 on= ly. Is there a way? Thanks Kumar ------=_NextPart_000_00FC_01C39738.D7B67E90 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Dear Friends,
 
I am working with Postgres 7.3.4 on RH Linux server=20 7.2.
 
Using pg_dump I could manage to take a script for all t= he DB=20 objects. But wanted to take the script (DDL) for all the scripts in my data= base.=20 While I searched I dont find any options in the pg_dump except for script t= ables=20 only.
 
Is there a way?
 
Thanks
Kumar

------=_NextPart_000_00FC_01C39738.D7B67E90-- From josh@agliodbs.com Mon Oct 20 17:22:54 2003 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 1AD7ED1B559 for ; Mon, 20 Oct 2003 17:22:54 +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 69861-05 for ; Mon, 20 Oct 2003 14:22:23 -0300 (ADT) Received: from davinci.ethosmedia.com (unknown [209.128.84.228]) by svr1.postgresql.org (Postfix) with ESMTP id 59635D1B55D for ; Mon, 20 Oct 2003 14:22:12 -0300 (ADT) Received: from [63.195.55.98] (HELO spooky) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3795397; Mon, 20 Oct 2003 10:22:52 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Organization: Aglio Database Solutions To: "Kumar" , "psql" Subject: Re: Scripting only the functions Date: Mon, 20 Oct 2003 10:21:41 -0700 User-Agent: KMail/1.4.3 References: <00ff01c3970a$c1c3d610$7502a8c0@hdsc.com> In-Reply-To: <00ff01c3970a$c1c3d610$7502a8c0@hdsc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <200310201021.41510.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/245 X-Sequence-Number: 15645 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 From dev@archonet.com Mon Oct 20 17:23:49 2003 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