pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedexcluding a table from pg_dump
7+ messages / 7 participants
[nested] [flat]
* excluding a table from pg_dump
@ 2005-10-20 14:23 Colton A Smith <smith@cs.utk.edu>
0 siblings, 1 reply; 7+ messages in thread
From: Colton A Smith @ 2005-10-20 14:23 UTC (permalink / raw)
To: pgsql-admin
Hi:
I don't think this is possible, but I want to make sure. Let's say I
have a database that I want to dump in its entirety, all except for one
particular table. Is there an option flag on pg_dump that accomplishes
this?
Thanks again!
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: excluding a table from pg_dump
@ 2005-10-25 09:08 Gourish Singbal <gourish@gmail.com>
parent: Colton A Smith <smith@cs.utk.edu>
0 siblings, 1 reply; 7+ messages in thread
From: Gourish Singbal @ 2005-10-25 09:08 UTC (permalink / raw)
To: Colton A Smith <smith@cs.utk.edu>; +Cc: pgsql-admin
pg_dump does not allow you to accomplish this task for sure.
--
Best,
Gourish Singbal
On 10/20/05, Colton A Smith <smith@cs.utk.edu> wrote:
>
> Hi:
>
> I don't think this is possible, but I want to make sure. Let's say I
> have a database that I want to dump in its entirety, all except for one
> particular table. Is there an option flag on pg_dump that accomplishes
> this?
>
> Thanks again!
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
>
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: excluding a table from pg_dump
@ 2005-10-25 09:31 Hannes Dorbath <light@theendofthetunnel.de>
parent: Gourish Singbal <gourish@gmail.com>
0 siblings, 1 reply; 7+ messages in thread
From: Hannes Dorbath @ 2005-10-25 09:31 UTC (permalink / raw)
To: pgsql-admin
It's possible with pg_restore to exclude that table on /restore/, but
that's not what you asked for..
On 25.10.2005 11:08, Gourish Singbal wrote:
> pg_dump does not allow you to accomplish this task for sure.
>
> On 10/20/05, Colton A Smith <smith@cs.utk.edu> wrote:
>> I don't think this is possible, but I want to make sure. Let's say I
>> have a database that I want to dump in its entirety, all except for one
>> particular table. Is there an option flag on pg_dump that accomplishes
>> this?
--
Regards,
Hannes Dorbath
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: excluding a table from pg_dump
@ 2005-10-25 16:28 Josh.Zeckser@jeppesen.com
parent: Hannes Dorbath <light@theendofthetunnel.de>
0 siblings, 1 reply; 7+ messages in thread
From: Josh.Zeckser@jeppesen.com @ 2005-10-25 16:28 UTC (permalink / raw)
To: Hannes Dorbath <light@theendofthetunnel.de>; +Cc: pgsql-admin; pgsql-admin-owner@postgresql.org
pgsql-admin-owner@postgresql.org wrote on 10/25/2005 02:31:51 AM:
> It's possible with pg_restore to exclude that table on /restore/, but
> that's not what you asked for..
>
> On 25.10.2005 11:08, Gourish Singbal wrote:
> > pg_dump does not allow you to accomplish this task for sure.
> >
> > On 10/20/05, Colton A Smith <smith@cs.utk.edu> wrote:
> >> I don't think this is possible, but I want to make sure. Let's say I
> >> have a database that I want to dump in its entirety, all except for
one
> >> particular table. Is there an option flag on pg_dump that
accomplishes
> >> this?
Here is an option: Dump into a test database, drop the table in the test
db & dump to file:
pg_dump originaldb | psql testdb < droptable.sql; pg_dump testdb >
dumpfile
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: excluding a table from pg_dump
@ 2005-10-25 16:33 Chris Browne <cbbrowne@acm.org>
parent: Josh.Zeckser@jeppesen.com
0 siblings, 1 reply; 7+ messages in thread
From: Chris Browne @ 2005-10-25 16:33 UTC (permalink / raw)
To: pgsql-admin
Josh.Zeckser@jeppesen.com writes:
> pgsql-admin-owner@postgresql.org wrote on 10/25/2005 02:31:51 AM:
>> It's possible with pg_restore to exclude that table on /restore/, but
>> that's not what you asked for..
>>
>> On 25.10.2005 11:08, Gourish Singbal wrote:
>> > pg_dump does not allow you to accomplish this task for sure.
>> >
>> > On 10/20/05, Colton A Smith <smith@cs.utk.edu> wrote:
>> >> I don't think this is possible, but I want to make sure. Let's say I
>> >> have a database that I want to dump in its entirety, all except for one
>> >> particular table. Is there an option flag on pg_dump that accomplishes
>> >> this?
> Here is an option: Dump into a test database, drop the table in the
> test db & dump to file: pg_dump originaldb | psql testdb <
> droptable.sql; pg_dump testdb > dumpfile
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.
By the way, it is quite likely that the above approach would be more
quickly accomplished via using originaldb as a template for testdb.
Thus...
$ createdb --template=originaldb testdb
$ for tables in t1 t2 t3 t4 t4; do
> psql -d testdb -c "drop table public.t1;"
done
$ pg_dump testdb > dumpfile
$ dropdb testdb
--
"cbbrowne","@","cbbrowne.com"
http://www3.sympatico.ca/cbbrowne/finances.html
"Wow! You read advocacy groups once in a while, thinking you'll find
the occasional gem, but when you unearth the Taj Mahal you still have
to stand back and gape a little." -- Paul Phillips <paulp@go2net.com>
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: excluding a table from pg_dump
@ 2005-10-25 17:39 Harald Fuchs <hf0923x@protecting.net>
parent: Chris Browne <cbbrowne@acm.org>
0 siblings, 1 reply; 7+ messages in thread
From: Harald Fuchs @ 2005-10-25 17:39 UTC (permalink / raw)
To: pgsql-admin
In article <60zmoxblq0.fsf@dba2.int.libertyrms.com>,
Chris Browne <cbbrowne@acm.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.
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: excluding a table from pg_dump
@ 2005-10-27 21:45 Dario <dario_d_s@unitech.com.ar>
parent: Harald Fuchs <hf0923x@protecting.net>
0 siblings, 0 replies; 7+ messages in thread
From: Dario @ 2005-10-27 21:45 UTC (permalink / raw)
To: 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@postgresql.org
[mailto:pgsql-admin-owner@postgresql.org]En nombre de Harald Fuchs
Enviado el: martes, 25 de octubre de 2005 14:40
Para: pgsql-admin@postgresql.org
Asunto: Re: [ADMIN] excluding a table from pg_dump
In article <60zmoxblq0.fsf@dba2.int.libertyrms.com>,
Chris Browne <cbbrowne@acm.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
^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2005-10-27 21:45 UTC | newest]
Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-10-20 14:23 excluding a table from pg_dump Colton A Smith <smith@cs.utk.edu>
2005-10-25 09:08 ` Gourish Singbal <gourish@gmail.com>
2005-10-25 09:31 ` Hannes Dorbath <light@theendofthetunnel.de>
2005-10-25 16:28 ` Josh.Zeckser@jeppesen.com
2005-10-25 16:33 ` Chris Browne <cbbrowne@acm.org>
2005-10-25 17:39 ` Harald Fuchs <hf0923x@protecting.net>
2005-10-27 21:45 ` Dario <dario_d_s@unitech.com.ar>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox