Dump all except some tables?

From: WireSpot <wirespot(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Dump all except some tables?
Date: 2005-10-06 10:59:44
Message-ID: b2d4b0380510060359t3342bc7bmee7446157416f587@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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.

Any idea, other than messing around with the dump file? I don't look forward
to grepping a dump which is several tens of megabytes gzipped...

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
contraints in place, and if the table data is not fed back in the right
order it's useless.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bart van den Eijnden 2005-10-06 11:45:49 text file import
Previous Message Martijn van Oosterhout 2005-10-06 09:57:32 Re: Securing Postgres