Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
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


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.



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

In response to

pgsql-novice by date

Next:From: Frank BaxDate: 2006-06-15 12:03:07
Subject: Re: Replacing data
Previous:From: chelsea bootDate: 2006-06-15 11:22:49
Subject: Replacing data

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group