Re: excluding a table from pg_dump

From: "Dario" <dario_d_s(at)unitech(dot)com(dot)ar>
To: <pgsql-admin(at)postgresql(dot)org>
Subject: Re: excluding a table from pg_dump
Date: 2005-10-27 21:45:36
Message-ID: MHEDJHCKDNOEHJKHIOCJAEBCCJAA.dario_d_s@unitech.com.ar
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

May be... you could dump your schema in plain format, (dump only schema),
create a new database, restore schema, and then do something like

psql -c "select \'pg_dump --table=\'||name||\'--disable-triggers
database_\' from pg_class where (condition that filters system
tables)">dumper.sh

(I'm not sure about escaping (or lack of) in quotes and pipes...)

your file will be full of:
pg_dump --table=table1 --disable-triggers database_
pg_dump --table=table2 --disable-triggers database_

then you could edit that file and delete the large table dump.
run the script to a generate your dump and filter for undesired things. then
run the file with psql. When things go wrong, start all over. This only is
usefull if you need to do it in a periodically basis. Otherwise I assume it
will be easier to do it by hand.

I never did it in postgresql. I will try to make it work and give you more
detail about the necesary steps, but only the next wednesday. May be someone
could complete (or refute this idea)

(My english is definitly bad)

greetings. long life and beer.

-----Mensaje original-----
De: pgsql-admin-owner(at)postgresql(dot)org
[mailto:pgsql-admin-owner(at)postgresql(dot)org]En nombre de Harald Fuchs
Enviado el: martes, 25 de octubre de 2005 14:40
Para: pgsql-admin(at)postgresql(dot)org
Asunto: Re: [ADMIN] excluding a table from pg_dump

In article <60zmoxblq0(dot)fsf(at)dba2(dot)int(dot)libertyrms(dot)com>,
Chris Browne <cbbrowne(at)acm(dot)org> writes:

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

As long as we don't have "pg_dump -X" (or something like that) you
could put the tables you don't want to dump into another schema.

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Fred Pope 2005-10-28 21:20:54 Error:PG_DUMP relation pg_user does not exist
Previous Message Bruno Wolff III 2005-10-27 02:47:28 Re: Memory/Performance issue: server closed the connection