From: | "Milen Kulev" <makulev(at)gmx(dot)net> |
---|---|
To: | "'Tom Lane'" <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: "Pg_restore -C" is not creating a database ( Was Create database bug in 8.1.3 ? ) |
Date: | 2006-04-09 18:15:42 |
Message-ID: | 000c01c65c01$9d5fecf0$0a00a8c0@trivadis.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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(at)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(at)postgresql(dot)org [mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Tom Lane
Sent: Sunday, April 09, 2006 6:01 PM
To: Milen Kulev
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] "Pg_restore -C" is not creating a database ( Was Create database bug in 8.1.3 ? )
"Milen Kulev" <makulev(at)gmx(dot)net> 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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2006-04-09 18:24:15 | Re: "Pg_restore -C" is not creating a database ( Was Create database bug in 8.1.3 ? ) |
Previous Message | Tyler MacDonald | 2006-04-09 17:51:37 | Re: Debian package for freeradius_postgresql module |