Search Postgresql Archives

Re: "Pg_restore -C" is not creating a database ( Was Create database bug in 8.1.3 ? )

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

 



Hello Tom,
I am  getting the commands you mention:
 pg_restore  -C -Fc tdb1b.bak  1> OUT
 Less OUT:

CREATE DATABASE testdb1 WITH TEMPLATE = template0 ENCODING = 'UTF8' TABLESPACE = tbs1;
ALTER DATABASE testdb1 OWNER TO pg;
\connect testdb1
...

, but testdb1  is NOT created ! That is actually my problem.
According to the documentation, the DB should be created (-C  option).
If I pre-create the database and then issue "pg_restore  -C -Fc tdb1b.bak" all objects 
get created as expected.

I am seeing some "DROP DATABASE" commend in the tdb1b.bak file (binary format)

pg@node5#[server1] /tmp]$ strings  tdb1b.bak | less
PGDMP
testdb1
8.1.3
8.1.3
ENCODING
ENCODING
SET client_encoding = 'UTF8';
false
1262
41411
testdb1
DATABASE
CREATE DATABASE testdb1 WITH TEMPLATE = template0 ENCODING = 'UTF8' TABLESPACE = tbs1;
DROP DATABASE testdb1;  <--!!!!!!!
false
2615
2200
public
SCHEMA
CREATE SCHEMA public;
DROP SCHEMA public;



Regards. Milen 


-----Original Message-----
From: pgsql-general-owner@xxxxxxxxxxxxxx [mailto:pgsql-general-owner@xxxxxxxxxxxxxx] On Behalf Of Tom Lane
Sent: Sunday, April 09, 2006 6:01 PM
To: Milen Kulev
Cc: pgsql-general@xxxxxxxxxxxxxx
Subject: Re: [GENERAL] "Pg_restore -C" is not creating a database ( Was Create database bug in 8.1.3 ? ) 


"Milen Kulev" <makulev@xxxxxxx> writes:
> 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).

Works AFAICS --- I see this in pg_restore's output:

	CREATE DATABASE testdb1 WITH TEMPLATE = template0 ENCODING = 'UTF8';

	ALTER DATABASE testdb1 OWNER TO postgres;

	\connect testdb1

Are you not getting those commands?  Maybe they are failing for some reason?

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster



[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