Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 73A029FB27D for ; Mon, 2 Apr 2007 11:45:57 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 86212-05-2 for ; Mon, 2 Apr 2007 11:45:38 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.247]) by postgresql.org (Postfix) with ESMTP id AC1B79FA4F0 for ; Mon, 2 Apr 2007 11:45:49 -0300 (ADT) Received: by an-out-0708.google.com with SMTP id c24so1285209ana for ; Mon, 02 Apr 2007 07:45:48 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=fCM7X7VNOqqELAknpwXjyxF7TaishWpiqh9CHg5B+fmsp1xjD4xdJBQEBtiSDl3yZVxS9wXSXzI+7xxPIFl+2G2NEkIYV1s/3MjF1uAO5KGxYofWe1LHq4YaFLLmM9AvnaRLu88iCcyvIkKV3hYOf1fbwMTSKzLk6fdphzO0W+o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=WJ5icvnosjbZdIIRE4/cVRutxcnghv8QRuw+M5YgsnzwrdjlqZ6Ckq4LGxO2IwT7b4+y3MROZuWP04rbhV8LEvlQWOCbVnW8GdSUTpsZLjtd8AJqkysLz7K6KGX4MdigyqyprUr2gXcFD0H8rwA59isDFqlyuNhvsuU+TtrgDPc= Received: by 10.100.34.16 with SMTP id h16mr3534197anh.1175525148083; Mon, 02 Apr 2007 07:45:48 -0700 (PDT) Received: by 10.100.14.1 with HTTP; Mon, 2 Apr 2007 07:45:48 -0700 (PDT) Message-ID: Date: Mon, 2 Apr 2007 19:45:48 +0500 From: "Shoaib Mir" To: arnaulist@andromeiberica.com Subject: Re: Dumping views, functions, ... Cc: pgsql-admin@postgresql.org In-Reply-To: <461112F9.70101@andromeiberica.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_87189_5290923.1175525148043" References: <461112F9.70101@andromeiberica.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200704/12 X-Sequence-Number: 25076 ------=_Part_87189_5290923.1175525148043 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline You can use the following query to get all the views: select 'CREATE VIEW '||viewname||' AS '||definition as viewSQL from pg_views where schemaname=''; -- Shoaib Mir EnterpriseDB (www.enterprisedb.com) On 4/2/07, Arnau wrote: > > Hi all, > > Lets say that in my database I have a view named foo_view and I'd > like to dump it's definition. I'd like to do something like: > > pg_dump --view=foo_view bar_db > foo_view.log > > so I'd have in the foo_view.log file the foo_view's definition. This > same concept I'm searching to apply it to rules, functions, ... > > I have been looking into pg_dump options and I haven't found the way. > The most similar thing I have found is -t option that does what I need > but with tables. Is it possible to do this with pg_dump? > > Thanks > -- > Arnau > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Have you searched our list archives? > > http://archives.postgresql.org > ------=_Part_87189_5290923.1175525148043 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline You can use the following query to get all the views:

select 'CREATE VIEW '||viewname||' AS '||definition as viewSQL from pg_views where schemaname='<schemaname>';

--
Shoaib Mir
EnterpriseDB (www.enterprisedb.com)

On 4/2/07, Arnau <arnaulist@andromeiberica.com > wrote:
Hi all,

   Lets say that in my database I have a view named foo_view and I'd
like to dump it's definition. I'd like to do something like:

  pg_dump --view=foo_view bar_db > foo_view.log

  so I'd have in the foo_view.log file the foo_view's definition. This
same concept I'm searching to apply it to rules, functions, ...

   I have been looking into pg_dump options and I haven't found the way.
The most similar thing I have found is -t option that does what I need
but with tables. Is it possible to do this with pg_dump?

Thanks
--
Arnau

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

               http://archives.postgresql.org

------=_Part_87189_5290923.1175525148043--