Re: problems with pg_dump and pg_restore

From: admin(at)usachurch(dot)com
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: problems with pg_dump and pg_restore
Date: 2004-10-07 18:44:21
Message-ID: p0611040abd8b3defd798@[192.168.123.110]
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

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

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Simon Riggs 2004-10-07 20:58:24 Re: Multiple WALs for PITR ?
Previous Message Tom Lane 2004-10-07 16:55:55 Re: [Fwd: Re: Question about pgfsck]