pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Meskes <michael@fam-meskes.de>
To: rodneyr@embratel.com.br
Cc: pgsql-interfaces@hub.org
Subject: Re: [INTERFACES] Create a database with ecpg
Date: Mon, 27 Sep 1999 11:55:30 +0200
Message-ID: <19990927115530.A375@fam-meskes.de> (raw)
In-Reply-To: <032567F4.0006E7A5.00@ntrjo008.nt.embratel.com.br>
References: <032567F4.0006E7A5.00@ntrjo008.nt.embratel.com.br>

On Tue, Sep 21, 1999 at 10:15:33PM -0300, rodneyr@embratel.com.br wrote:
> "EXEC SQL CREATE DATABASE testbase;"
> 
> Then I compiled it, using ecpg, but the database was't been created.

In fact only a directory was created, right?

> When a try to open it with "psql" I receive the message:
> 
> Connection to database 'testbase' failed.
> FATAL 1:  Database testbase does not exist in pg_database
> 
> Is there any mistake in my statement?

Yes and no. The statement itself is correct. However, the usage is not. I
take it you are executing the statement inside a transaction but do not
issue a commit afterwards. Thus pg_database is not updated at all.

Please try calling EXEC SQL COMMIT; after the CREATE DATABASE call. This
should work. At least it does for me. 

Or call ecpg with parameter '-t' to switch off autotransaction mode. With
'-t' the CREATE DATABASE statement becomes a transaction for itself and thus
is committed once it returns.

Hope this helps.

Michael
-- 
Michael Meskes                         | Go SF 49ers!
Th.-Heuss-Str. 61, D-41812 Erkelenz    | Go Rhein Fire!
Tel.: (+49) 2431/72651                 | Use Debian GNU/Linux!
Email: Michael@Fam-Meskes.De           | Use PostgreSQL!



view thread (6+ messages)  latest in thread

Message-ID: <19990927115530.A375@fam-meskes.de>
Permalink:  ../19990927115530.A375@fam-meskes.de/
Also on:    postgresql.org/message-id/19990927115530.A375@fam-meskes.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: michael@fam-meskes.de, rodneyr@embratel.com.br, pgsql-interfaces@hub.org
  Subject: Re: [INTERFACES] Create a database with ecpg
  In-Reply-To: <19990927115530.A375@fam-meskes.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox