pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: admin@usachurch.com
To: pgsql-admin@postgresql.org
Subject: Re: problems with pg_dump and pg_restore
Date: Thu, 7 Oct 2004 11:44:21 -0700
Message-ID: <p0611040abd8b3defd798@[192.168.123.110]> (raw)
In-Reply-To: <28920.1097162275@sss.pgh.pa.us>
References: <B7F9814D6850C949947CF8DEA13477810207AAB5@s5-ccr-r2.ccrs.nrcan.gc.ca>
	<ck1tfn$4d2$2@floppy.pyrenet.fr>
	<1790.1097106631@sss.pgh.pa.us>
	<p06110400bd8a69770b18@[192.168.123.110]>
	<28920.1097162275@sss.pgh.pa.us>

>  > 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.

Tom,

But if I first "dropdb -U admin staging", and then issue:
pg_restore -U admin -C -d staging /home/postgres/staging-dump

I get the error:
pg_restore: [archiver (db)] connection to database "staging" failed: 
FATAL:  database "staging" does not exist

Yet the docs state that the above command should Create the database 
named by the "-d staging"
part of the command.  I'm confused as to why that doesn't work.  I 
also am not sure what the
template1 and template0 are there for.

Regards,
Devin



view thread (3+ messages)

Message-ID: <p0611040abd8b3defd798@[192.168.123.110]>
Permalink:  ../p0611040abd8b3defd798@%5B192.168.123.110%5D/
Also on:    postgresql.org/message-id/p0611040abd8b3defd798@[192.168.123.110]

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: admin@usachurch.com
  Subject: Re: problems with pg_dump and pg_restore
  In-Reply-To: <p0611040abd8b3defd798@[192.168.123.110]>
  References: <B7F9814D6850C949947CF8DEA13477810207AAB5@s5-ccr-r2.ccrs.nrcan.gc.ca> <ck1tfn$4d2$2@floppy.pyrenet.fr> <1790.1097106631@sss.pgh.pa.us> <p06110400bd8a69770b18@[192.168.123.110]> <28920.1097162275@sss.pgh.pa.us> <p0611040abd8b3defd798@[192.168.123.110]>

* 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