Re: pg_restore won't create database

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Christopher J(dot) Bottaro" <cjbottaro(at)alumni(dot)cs(dot)utexas(dot)edu>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: pg_restore won't create database
Date: 2005-06-16 16:04:56
Message-ID: 16541.1118937896@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Christopher J. Bottaro" <cjbottaro(at)alumni(dot)cs(dot)utexas(dot)edu> writes:
> $ pg_restore -C -d test_backup_db backup.pgd
> pg_restore: [archiver (db)] connection to database "test_backup_db" failed:
> FATAL: database "test_backup_db" does not exist

> What am I doing wrong? Thank you for the help.

Trying to connect to a database that doesn't exist yet.

The usual approach is something like

pg_restore -C -d template1 backup.pgd

Note you can only use -C to restore to a database named the same as the
dump was taken from. If you want to restore into a different database
name, you can't use -C; instead the plan is

createdb new_db
pg_restore -d new_db backup.pgd

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Josh Berkus 2005-06-16 16:13:54 Re: Autovacuum in the backend
Previous Message Christopher J. Bottaro 2005-06-16 15:50:22 pg_restore won't create database