Search Postgresql Archives

Re: pg_restore won't create database

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Christopher J. Bottaro" <cjbottaro@xxxxxxxxxxxxxxxxxxxx> 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

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux