restore single table

Started by Liz Pelletierover 24 years ago5 messagesgeneral
Jump to latest
#1Liz Pelletier
liz@plandepot.com

If I have a dump of myDB, and I want to restore only two tables from
this dump, is there a way to do this? Or do I have to restore the entire
db?

(BTW, using 7.1 on a Debian box.)

Thanks in advance,
Liz

#2Mitch Vincent
mvincent@cablespeed.com
In reply to: Liz Pelletier (#1)
Re: restore single table

You could grab the entries from the backup file but it require a little
coding (Some creative use of grep/awk could probably do it)...

Or load the entire backup into a temp database then dump from the temp
database only the tables you want and import then into whichever database
you'd like...

*shrug* either way, you have to jump through a few hoops...

Good luck!

-Mitch

----- Original Message -----
From: "Liz Pelletier" <liz@plandepot.com>
To: <pgsql-general@postgresql.org>
Sent: Wednesday, July 18, 2001 11:46 AM
Subject: [GENERAL] restore single table

Show quoted text

If I have a dump of myDB, and I want to restore only two tables from
this dump, is there a way to do this? Or do I have to restore the entire
db?

(BTW, using 7.1 on a Debian box.)

Thanks in advance,
Liz

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

http://www.postgresql.org/users-lounge/docs/faq.html

#3Thalis A. Kalfigopoulos
thalis@cs.pitt.edu
In reply to: Liz Pelletier (#1)
Re: restore single table

$ pg_restore --help

.
.
.
-t, --table[=TABLE] restore this table only
.
.
.

cheers,
thalis

On Wed, 18 Jul 2001, Liz Pelletier wrote:

Show quoted text

If I have a dump of myDB, and I want to restore only two tables from
this dump, is there a way to do this? Or do I have to restore the entire
db?

(BTW, using 7.1 on a Debian box.)

Thanks in advance,
Liz

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

http://www.postgresql.org/users-lounge/docs/faq.html

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Liz Pelletier (#1)
Re: restore single table

Liz Pelletier <liz@plandepot.com> writes:

If I have a dump of myDB, and I want to restore only two tables from
this dump, is there a way to do this?

I believe pg_restore can do that sort of thing, if the dump was made
by 7.1 pg_dump. Haven't used it myself though...

regards, tom lane

#5Richard Huxton
dev@archonet.com
In reply to: Liz Pelletier (#1)
Re: restore single table

From: "Liz Pelletier" <liz@plandepot.com>

If I have a dump of myDB, and I want to restore only two tables from
this dump, is there a way to do this? Or do I have to restore the entire
db?

(BTW, using 7.1 on a Debian box.)

Try pg_restore if you used pg_dump's new option (never tried it myself).

If you dumped your database as text (INSERTs/COPY) it's cut & paste time (or
a couple of greps and a short perl script).

- Richard Huxton