From: Chris Browne <cbbrowne@acm.org>
To: pgsql-admin@postgresql.org
Subject: Re: excluding a table from pg_dump
Date: Tue, 25 Oct 2005 12:33:11 -0400
Message-ID: <60zmoxblq0.fsf@dba2.int.libertyrms.com> (raw)
References: <djku15$1pok$1@news.hub.org>
<OF2B49548C.211C52F3-ON082570A5.005A6DD8-882570A5.0054E5B9@jeppesen.com>
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 <smith@cs.utk.edu> 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 <paulp@go2net.com>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: cbbrowne@acm.org
Subject: Re: excluding a table from pg_dump
In-Reply-To: <60zmoxblq0.fsf@dba2.int.libertyrms.com>
References: <djku15$1pok$1@news.hub.org> <OF2B49548C.211C52F3-ON082570A5.005A6DD8-882570A5.0054E5B9@jeppesen.com> <60zmoxblq0.fsf@dba2.int.libertyrms.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox