Re: Replacing data - Mailing list pgsql-novice

From Aarni Ruuhimäki
Subject Re: Replacing data
Date
Msg-id 200606151443.01532.aarni@kymi.com
Whole thread Raw
In response to Replacing data  (chelsea boot <scx6148@yahoo.co.uk>)
List 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 by date:

Previous
From: "A. Kretschmer"
Date:
Subject: Re: reference constraint creation problem
Next
From: "Frances Collier"
Date:
Subject: windows update screwed up PostgreSQL