Re: Replacing data

Поиск
Список
Период
Сортировка
От Aarni Ruuhimäki
Тема Re: Replacing data
Дата
Msg-id 200606151443.01532.aarni@kymi.com
обсуждение исходный текст
Ответ на Replacing data  (chelsea boot <scx6148@yahoo.co.uk>)
Список pgsql-novice
On Thursday 15 June 2006 14:22, chelsea boot wrote:
> Hi
>
>   I want to replace all the data in a database with an earlier backup I
> took.  I have a plain sql-script dump (backup.sql) and am using the
> following command to replace the current data:
>
>   psql -U postgres dbname < backup.sql
>
>   However, the command seems to append the data to the database so that I
> have the old data and any new data added since the backup was taken.  How
> can I replace all the data so that my database only contains data from the
> backup?  Maybe I'm using the wrong backup and restore method?
>
>   Thanks
>
>  Send instant messages to your online friends http://uk.messenger.yahoo.com

Hi,

pg_dump -c

creates a dump file which when run will first remove everything and then
create everything and then load the data.

See pg_dump --help for more options.

BR,

Aarni


--------------
This is a bugfree broadcast to you
from **Kmail**
on **Fedora Core** linux system
--------------

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

Предыдущее
От: "A. Kretschmer"
Дата:
Сообщение: Re: reference constraint creation problem
Следующее
От: "Frances Collier"
Дата:
Сообщение: windows update screwed up PostgreSQL