Re: Restoring selected records from backup file

Поиск
Список
Период
Сортировка
От Daniel Staal
Тема Re: Restoring selected records from backup file
Дата
Msg-id 0BD1A802FC8596B3936A4B37@mac-pro.magehandbook.com
обсуждение исходный текст
Ответ на Restoring selected records from backup file  (Piyush Lenka <lenka.piyush@gmail.com>)
Список pgsql-novice
--As of March 2, 2012 3:44:46 PM +0530, Piyush Lenka is alleged to have
said:

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

--As for the rest, it is mine.

A plain text backup will just be a set of SQL commands.  You'll need to
isolate those commands that have the selected records, copy them out into a
new file, and then feed that file to psql.

If you are on a unix-like box, `grep` will be useful for this.

Note that there will probably be some SQL editing involved: the backup is
optimized for full-table restores, and therefore has multiple records per
statement, usually.  (Depending on options specified at the backup creation
time: If you are expecting this to be a common type of restore, it might be
a good idea to use the `--inserts` or even `--column-inserts` switch.
Either will slow down a full restore considerably, but would make this type
of restore easy.  See the docs for full details.)

Daniel T. Staal

---------------------------------------------------------------
This email copyright the author.  Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes.  This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---------------------------------------------------------------

В списке pgsql-novice по дате отправления:

Предыдущее
От: Brent Dombrowski
Дата:
Сообщение: Re: Data In Tables Sometimes Have +
Следующее
От: Tareq Aljabban
Дата:
Сообщение: initDB - storage manager issues