X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EE223329EE8 for ; Thu, 7 Oct 2004 16:17:58 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 98124-09 for ; Thu, 7 Oct 2004 15:17:57 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id B5767329E94 for ; Thu, 7 Oct 2004 16:17:56 +0100 (BST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id i97FHtmP028921; Thu, 7 Oct 2004 11:17:55 -0400 (EDT) To: admin@usachurch.com Cc: pgsql-admin@postgresql.org Subject: Re: problems with pg_dump and pg_restore In-reply-to: References: <1790.1097106631@sss.pgh.pa.us> Comments: In-reply-to admin@usachurch.com message dated "Wed, 06 Oct 2004 20:52:17 -0700" Date: Thu, 07 Oct 2004 11:17:55 -0400 Message-ID: <28920.1097162275@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200410/115 X-Sequence-Number: 15108 admin@usachurch.com writes: > pg_restore -U admin -c /home/postgres/staging-dump > Now, although tons of data is now streaming to my monitor, when it is > done, none of the new data is in the backup's staging db. The default behavior of pg_restore is to emit SQL commands onto stdout, which of course is not going to do a lot for your backup DB. What you probably want is to include a "-d database" switch to tell it to connect to a database and send the commands there. > So, I tried doing this variation: > pg_restore -U admin -C -d staging /home/postgres/staging-dump > pg_restore: [archiver (db)] could not execute query: ERROR: database > "staging" already exists -C tells it to create (and then connect to) the target DB, rather than connect to an existing DB and restore into that. So generally you want to say "-d template1" (or some other existing DB) when you use -C. regards, tom lane