From: | Berend Tober <btober(at)seaworthysys(dot)com> |
---|---|
To: | WireSpot <wirespot(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Dump all except some tables? |
Date: | 2005-10-06 12:08:49 |
Message-ID: | 434513D1.1020102@seaworthysys.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
WireSpot wrote:
> 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.
I don't think you can limit the dump output precisely as you ask, but
you can get the equivalent by doing a custom format dump, then use
pg_restore to produce a archive listing, which you then edit so as to
select specific objects you want to include/exclude, and then run
pg_restore against that edited list file.
From | Date | Subject | |
---|---|---|---|
Next Message | Bohdan Linda | 2005-10-06 12:23:01 | Re: Securing Postgres |
Previous Message | A. Kretschmer | 2005-10-06 11:59:33 | Re: Dump all except some tables? |