pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
restore single table
7+ messages / 7 participants
[nested] [flat]

* restore single table
@ 2001-07-18 15:46  Liz Pelletier <liz@plandepot.com>
  0 siblings, 4 replies; 7+ messages in thread

From: Liz Pelletier @ 2001-07-18 15:46 UTC (permalink / raw)
  To: pgsql-general

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



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: restore single table
@ 2001-07-18 16:02  Mitch Vincent <mvincent@cablespeed.com>
  parent: Liz Pelletier <liz@plandepot.com>
  3 siblings, 0 replies; 7+ messages in thread

From: Mitch Vincent @ 2001-07-18 16:02 UTC (permalink / raw)
  To: liz@plandepot.com; pgsql-general

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


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




^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: restore single table
@ 2001-07-18 16:13  Thalis A. Kalfigopoulos <thalis@cs.pitt.edu>
  parent: Liz Pelletier <liz@plandepot.com>
  3 siblings, 0 replies; 7+ messages in thread

From: Thalis A. Kalfigopoulos @ 2001-07-18 16:13 UTC (permalink / raw)
  To: Liz Pelletier <liz@plandepot.com>; +Cc: pgsql-general

$ pg_restore --help

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

cheers,
thalis




On Wed, 18 Jul 2001, Liz Pelletier wrote:

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




^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: restore single table
@ 2001-07-18 16:24  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Liz Pelletier <liz@plandepot.com>
  3 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2001-07-18 16:24 UTC (permalink / raw)
  To: liz@plandepot.com; +Cc: pgsql-general

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



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: restore single table
@ 2001-07-18 16:35  Richard Huxton <dev@archonet.com>
  parent: Liz Pelletier <liz@plandepot.com>
  3 siblings, 0 replies; 7+ messages in thread

From: Richard Huxton @ 2001-07-18 16:35 UTC (permalink / raw)
  To: liz@plandepot.com; pgsql-general

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




^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Restore single table
@ 2019-10-30 12:21  Sonam Sharma <sonams1209@gmail.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Sonam Sharma @ 2019-10-30 12:21 UTC (permalink / raw)
  To: pgsql-general

Can someone please help me with the command to restore a single table using
psql.

Took the backup using below command :
pg_dump -t (tablename) dbname > tablename.sql

^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Restore single table
@ 2019-10-30 12:29  Ritesh Jha <kumarritesh309@gmail.com>
  parent: Sonam Sharma <sonams1209@gmail.com>
  0 siblings, 0 replies; 7+ messages in thread

From: Ritesh Jha @ 2019-10-30 12:29 UTC (permalink / raw)
  To: Sonam Sharma <sonams1209@gmail.com>; +Cc: pgsql-general

psql -d databaseName -f tablename.sql

On Wed, Oct 30, 2019, 5:51 PM Sonam Sharma <sonams1209@gmail.com> wrote:

> Can someone please help me with the command to restore a single table
> using psql.
>
> Took the backup using below command :
> pg_dump -t (tablename) dbname > tablename.sql
>

^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2019-10-30 12:29 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-07-18 15:46 restore single table Liz Pelletier <liz@plandepot.com>
2001-07-18 16:02 ` Mitch Vincent <mvincent@cablespeed.com>
2001-07-18 16:13 ` Thalis A. Kalfigopoulos <thalis@cs.pitt.edu>
2001-07-18 16:24 ` Tom Lane <tgl@sss.pgh.pa.us>
2001-07-18 16:35 ` Richard Huxton <dev@archonet.com>
2019-10-30 12:21 Restore single table Sonam Sharma <sonams1209@gmail.com>
2019-10-30 12:29 ` Re: Restore single table Ritesh Jha <kumarritesh309@gmail.com>

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