Re: Dump all except some tables? - Mailing list pgsql-general

From WireSpot
Subject Re: Dump all except some tables?
Date
Msg-id b2d4b0380510060529o5202c6c8i2e77231deca492d3@mail.gmail.com
Whole thread Raw
In response to Re: Dump all except some tables?  ("A. Kretschmer" <akretschmer@despammed.com>)
Responses Re: Dump all except some tables?  ("A. Kretschmer" <akretschmer@despammed.com>)
Re: Dump all except some tables?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On 10/6/05, A. Kretschmer <akretschmer@despammed.com> wrote:
> 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

Yes, pg_dump doesn't complain. But it only takes the first one into
consideration. I only get one table in the dump.

> > 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.

That's exactly what I'm trying to avoid. If possible, I wanted to
avoid having to dump them at all. We're talking a lot of logging data
that is of no use where the dump is going.

> 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)

Interesting, I'll look into it. If mangling the restore list works, it
would solve the problem halfway (at the restoring moment).

pgsql-general by date:

Previous
From: Bohdan Linda
Date:
Subject: Re: Securing Postgres
Next
From: "A. Kretschmer"
Date:
Subject: Re: Dump all except some tables?