Re: pg_restore - Mailing list pgsql-admin

From Tom Lane
Subject Re: pg_restore
Date
Msg-id 25775.1150607196@sss.pgh.pa.us
Whole thread Raw
In response to Re: pg_restore  (Infor Gates <info_gates@yahoo.com>)
Responses Re: pg_restore  ("Aaron Bono" <postgresql@aranya.com>)
List pgsql-admin
Infor Gates <info_gates@yahoo.com> writes:
> I am having the impression that pg_restore would over-rides the "old"
> data with the current one. Is my thinking wrong?

Yeah.  By default, pg_restore will issue a CREATE TABLE (which of course
fails if the table already exists) followed by COPY (which just tries to
insert data in addition to what might be there already).

There's a command line option to ask pg_restore to try to DROP TABLE
before doing the CREATE TABLE.  By and large, though, that's a bad way
to proceed unless you are specifically trying to merge two databases.
The fast and easy way to proceed is to DROP DATABASE, CREATE a fresh
empty database, and pg_restore into that.

            regards, tom lane

pgsql-admin by date:

Previous
From: Infor Gates
Date:
Subject: Re: pg_restore
Next
From: "Aaron Bono"
Date:
Subject: Re: pg_restore