From: | "Milen Kulev" <makulev(at)gmx(dot)net> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Subject: | "Pg_restore -C" is not creating a database ( Was Create database bug in 8.1.3 ? ) |
Date: | 2006-04-09 13:54:12 |
Message-ID: | 000401c65bdd$15153810$0a00a8c0@trivadis.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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(at)postgresql(dot)org [mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of William ZHANG
Sent: Sunday, April 09, 2006 2:37 PM
To: pgsql-general(at)postgresql(dot)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?
From | Date | Subject | |
---|---|---|---|
Next Message | Douglas McNaught | 2006-04-09 14:05:16 | Re: Create database bug in 8.1.3 ? -> solved |
Previous Message | Philipp Ott | 2006-04-09 13:39:52 | Re: "Fat" binaries for OS X (was Re: [GENERAL] Postgres Library natively available for Mac OSX Intel?) |