X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4A5C5DAE43 for ; Tue, 25 Oct 2005 14:10:50 -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 03103-02 for ; Tue, 25 Oct 2005 17:10:46 +0000 (GMT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id D1E12DAE22 for ; Tue, 25 Oct 2005 14:10:46 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.13.1/8.13.1) with ESMTP id j9PHAk8s003206 for ; Tue, 25 Oct 2005 17:10:46 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.13.1/8.13.1/Submit) id j9PH4EEg094964 for pgsql-admin@postgresql.org; Tue, 25 Oct 2005 17:04:14 GMT (envelope-from news) From: Chris Browne X-Newsgroups: pgsql.admin Subject: Re: excluding a table from pg_dump Date: Tue, 25 Oct 2005 12:33:11 -0400 Organization: cbbrowne Computing Inc Lines: 42 Message-ID: <60zmoxblq0.fsf@dba2.int.libertyrms.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 X-Complaints-To: usenet@news.hub.org User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4.17 (Jumbo Shrimp, linux) Cancel-Lock: sha1:EQ9b9NSZQ5KUY5ItZKr+rcQKc+M= To: pgsql-admin@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=-2.483 required=5 tests=[ALL_TRUSTED=-2.82, AWL=0.337] X-Spam-Level: X-Archive-Number: 200510/263 X-Sequence-Number: 19335 Josh.Zeckser@jeppesen.com writes: > pgsql-admin-owner@postgresql.org wrote on 10/25/2005 02:31:51 AM: >> It's possible with pg_restore to exclude that table on /restore/, but >> that's not what you asked for.. >> >> On 25.10.2005 11:08, Gourish Singbal wrote: >> > pg_dump does not allow you to accomplish this task for sure. >> > >> > On 10/20/05, Colton A Smith wrote: >> >> I don't think this is possible, but I want to make sure. Let's say I >> >> have a database that I want to dump in its entirety, all except for one >> >> particular table. Is there an option flag on pg_dump that accomplishes >> >> this? > Here is an option: Dump into a test database, drop the table in the > test db & dump to file: pg_dump originaldb | psql testdb < > droptable.sql; pg_dump testdb > dumpfile A usual reason why I would want to dump everything except for a few tables is that those few tables are particularly enormous and particularly useless (at least, for the purposes of my dump). In that case, the LAST thing I want to do is to make extra copies of the *useless* tables. By the way, it is quite likely that the above approach would be more quickly accomplished via using originaldb as a template for testdb. Thus... $ createdb --template=originaldb testdb $ for tables in t1 t2 t3 t4 t4; do > psql -d testdb -c "drop table public.t1;" done $ pg_dump testdb > dumpfile $ dropdb testdb -- "cbbrowne","@","cbbrowne.com" http://www3.sympatico.ca/cbbrowne/finances.html "Wow! You read advocacy groups once in a while, thinking you'll find the occasional gem, but when you unearth the Taj Mahal you still have to stand back and gape a little." -- Paul Phillips