Re: Dump all except some tables?

From: "A(dot) Kretschmer" <akretschmer(at)despammed(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Dump all except some tables?
Date: 2005-10-06 11:59:33
Message-ID: 20051006115933.GI4329@webserv.wug-glas.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

am 06.10.2005, um 13:59:44 +0300 mailte WireSpot folgendes:
> Is it possible to dump an entire database but to skip one or two tables? Or,
> conversely, to restore an entire dump except for one or two tables?
> (Although I'd prefer the first version.)
>
> The only related option for both pg_dump and pg_restore is --table, which
> only takes 1 (one) table name. If only it accepted more than one I could've
> found a workaround.

You can use the -t more than once.

pg_dump -U foobar database -t foo -t foo1

> I'm considering doing a dump with --table for each table except the one or
> two in question. But I wonder, if I simply concatenate the resulting SQL
> dumps, will I get a valid dump? There are all kinds of foreign key

I'm not sure, perhaps if you dump with --data-only every table.

> contraints in place, and if the table data is not fed back in the right
> order it's useless.

Right.

You can do a dump from all tables and after restore all the tables you
can delete the one or two tables.

Other way:

pg_restore with '--use-list=list-file'. You can create a list of
contents of the archive and edit this list. (pg_restore --list)

Regards, Andreas
--
Andreas Kretschmer (Kontakt: siehe Header)
Heynitz: 035242/47212, D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
=== Schollglas Unternehmensgruppe ===

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Berend Tober 2005-10-06 12:08:49 Re: Dump all except some tables?
Previous Message Jan Söderback 2005-10-06 11:51:42 Fedora Core 3 x86_64 compat libraries?