pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Infor Gates <info_gates@yahoo.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: pg_restore
Date: Sun, 18 Jun 2006 01:06:36 -0400
Message-ID: <25775.1150607196@sss.pgh.pa.us> (raw)
In-Reply-To: <20060618025541.91508.qmail@web31110.mail.mud.yahoo.com>
References: <20060618025541.91508.qmail@web31110.mail.mud.yahoo.com>

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



view thread (25+ messages)  latest in thread

Message-ID: <25775.1150607196@sss.pgh.pa.us>
Permalink:  ../25775.1150607196@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/25775.1150607196@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, info_gates@yahoo.com
  Subject: Re: pg_restore
  In-Reply-To: <25775.1150607196@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox