Restoring selected records from backup file

Started by Piyush Lenkaabout 14 years ago2 messagesgeneral
Jump to latest
#1Piyush Lenka
lenka.piyush@gmail.com

hi,

1. How can we restore selected records from a plain text backup
(backup.sql).
2. Is it possible using psql. If yes how
Please Help

Thanks & Regards
Piyush

#2Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Piyush Lenka (#1)
Re: Restoring selected records from backup file

On Friday, March 02, 2012 2:20:14 am Piyush Lenka wrote:

hi,

1. How can we restore selected records from a plain text backup
(backup.sql).

The only way I know is to use some text processing tool to walk through and pull
out the records.

2. Is it possible using psql. If yes how

I assume you mean the psql client program. There is no way to get it to read a
backup file and pull data, as far as I know.

You can use the \copy command to pull out selected records from a table and dump
them to a disk file. See here for more info:
http://www.postgresql.org/docs/9.0/interactive/app-psql.html

You could also do a CREATE TABLE AS to create a table with the records you are
interested and then do pg_dump -t to get that information.

http://www.postgresql.org/docs/9.0/interactive/sql-createtableas.html

Please Help

Thanks & Regards
Piyush

--
Adrian Klaver
adrian.klaver@gmail.com