Re: Replacing data

From: Aarni Ruuhimäki <aarni(at)kymi(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Cc: chelsea boot <scx6148(at)yahoo(dot)co(dot)uk>
Subject: Re: Replacing data
Date: 2006-06-15 11:43:01
Message-ID: 200606151443.01532.aarni@kymi.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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
--------------

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Frank Bax 2006-06-15 12:03:07 Re: Replacing data
Previous Message chelsea boot 2006-06-15 11:22:49 Replacing data