Hi Listers,
My saga contunues ;(
I can not get pg_restore working as expected (as described in the documentation).
My case : I have a DB, that I have archived with
pg_dump -C -Fc -d testdb1 > tdb1b.bak
Then I am dropping the database testdb1 ( with DROP DATABASE testdb1; ) I want to recover it. When I issue the
following
command:
pg_restore -C -Fc tdb1b.bak
I am getting all the SQL statements executed, but the DB testdb1 is NOT created, although
I have explicitely specified it (-C option).
BUT if I create DB testdb1 manually and then issue:
pg_restore -Fc -d testdb1 < tdb1b.bak
I am getting the result what I want/expect.
What I am doinf wrong ?
Any hints, suggestions ?
Best Regards, Milen
-----Original Message-----
From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of William ZHANG
Sent: Sunday, April 09, 2006 2:37 PM
To: pgsql-general@postgresql.org
Subject: Re: [GENERAL] Create database bug in 8.1.3 ?
The backend doesnot save the name of the template database used by "CREATE DATABASE".
pg_dump, pg_dumpall have hard code like this:
appendPQExpBuffer(buf, " WITH TEMPLATE = template0"); That's why you found the template database is always
`template0`.
If the backend saves the name of the template database, and dump the database as
"CREATE DATABASE foo WITH TEMPLATE 'bar';",
dump and restore should be careful to dump/restore 'bar' before 'foo'. If 'bar' is modified after the "CREATE DATABASE"
command, things will be more complicated.
If you have not modified system catalogs in template1, using template0 in dump should cause no problem.
Regrads,
William ZHANG
---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?
http://archives.postgresql.org