X-Original-To: pgsql-admin-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 1538C9FA5F8 for ; Sun, 18 Jun 2006 02:06:44 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 46283-02 for ; Sun, 18 Jun 2006 02:06:38 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 83CB79FA5E6 for ; Sun, 18 Jun 2006 02:06:38 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k5I56asR025776; Sun, 18 Jun 2006 01:06:36 -0400 (EDT) To: Infor Gates cc: pgsql-admin@postgresql.org Subject: Re: pg_restore In-reply-to: <20060618025541.91508.qmail@web31110.mail.mud.yahoo.com> References: <20060618025541.91508.qmail@web31110.mail.mud.yahoo.com> Comments: In-reply-to Infor Gates message dated "Sat, 17 Jun 2006 19:55:41 -0700" Date: Sun, 18 Jun 2006 01:06:36 -0400 Message-ID: <25775.1150607196@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/143 X-Sequence-Number: 22105 Infor Gates 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