X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 73D4FD7E41 for ; Thu, 22 Sep 2005 09:12:16 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 43340-06 for ; Thu, 22 Sep 2005 12:12:12 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id DA8F0DA672 for ; Thu, 22 Sep 2005 09:12:12 -0300 (ADT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 7084D31F51; Thu, 22 Sep 2005 14:12:15 +0200 (MET DST) From: Hannes Dorbath X-Newsgroups: pgsql.sql Subject: Re: Copy Views From Database? Date: Thu, 22 Sep 2005 14:12:09 +0200 Organization: Hub.Org Networking Services Lines: 30 Message-ID: <43329F99.4060104@theendofthetunnel.de> References: <380-22005942283730262@M2W068.mail2web.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Thunderbird 1.4 (Windows/20050908) In-Reply-To: To: pgsql-sql@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.002 required=5 tests=[AWL=0.002] X-Spam-Level: X-Archive-Number: 200509/201 X-Sequence-Number: 22748 On 22.09.2005 11:47, lennie@corepat.com wrote: > How would you use it to only dump / restore the views? I don't want any database tables. Please RTFM. But because I'm such a nice guy: Create a binary dump of the schema: pg_dump -v -s -i -F c -Z 9 -U -f /tmp/dump.bin Use the -l option of pg_restore to create a TOC file and filter your views with grep: pg_restore -l /tmp/dump.bin | grep -E "[[:space:]]VIEW[[:space:]]" > /tmp/tmp.toc Check your TOC file with less to see if everything you want is in it: less /tmp/tmp.toc In case all seems fine run pg_restore with that TOC list as argument and check the SQL statements it generates: pg_restore -i -v -O -L /tmp/tmp.toc /tmp/dump.bin | less In case all seems fine again, run it against your other database: pg_restore -i -v -O -d -U -L /tmp/tmp.toc /tmp/dump.bin Hope it helps, in case it trashes your server, don't blame me and read the manual before you're doing anything. Best regards, Hannes Dorbath