pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Infor Gates <info_gates@yahoo.com>
To: Aaron Bono <postgresql@aranya.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Infor Gates <info_gates@yahoo.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: pg_restore
Date: Sun, 18 Jun 2006 18:02:50 -0700 (PDT)
Message-ID: <20060619010250.70185.qmail@web31115.mail.mud.yahoo.com> (raw)
In-Reply-To: <bf05e51c0606181429j75cfa4a9qdb7654d2b9b85d2c@mail.gmail.com>

Thanks Aaron

I am trying to do exactly the same thing. Now that my understanding of pg_restore is clearer. I was worried by my index key table was corrupted somehow and caused the error message.  This is the cause by my own misunderstanding.

CY

Aaron Bono <postgresql@aranya.com> wrote: I agree.  When restoring a database from back up, I do a drop database and recreate it to make sure everything is properly intact (tables, columns, views, triggers, foreign keys, etc...).  We do this a lot for testing.  We backup the production database, copy to test server and do a restore on the test database.  It helps us test our code rollouts. 

-Aaron

On 6/18/06, Tom Lane <tgl@sss.pgh.pa.us> wrote: 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
 

 				
---------------------------------
Do you Yahoo!?
 Next-gen email? Have it all with the  all-new Yahoo! Mail Beta. 

view thread (25+ messages)  latest in thread

Message-ID: <20060619010250.70185.qmail@web31115.mail.mud.yahoo.com>
Permalink:  ../20060619010250.70185.qmail@web31115.mail.mud.yahoo.com/
Also on:    postgresql.org/message-id/20060619010250.70185.qmail@web31115.mail.mud.yahoo.com

 · 

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: info_gates@yahoo.com, postgresql@aranya.com, tgl@sss.pgh.pa.us
  Subject: Re: pg_restore
  In-Reply-To: <20060619010250.70185.qmail@web31115.mail.mud.yahoo.com>

* 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