Re: Restoring selected records from backup file - Mailing list pgsql-general

From Adrian Klaver
Subject Re: Restoring selected records from backup file
Date
Msg-id 201203021521.13487.adrian.klaver@gmail.com
Whole thread Raw
In response to Restoring selected records from backup file  (Piyush Lenka <lenka.piyush@gmail.com>)
List pgsql-general
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

pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: role missing in dump
Next
From: Thomas Prause
Date:
Subject: Re: role missing in dump