Received: from tanja.fam-meskes.de (root@p3E9D3E6C.dip0.t-ipconnect.de [62.157.62.108]) by hub.org (8.9.3/8.9.3) with ESMTP id PAA13768 for ; Mon, 27 Sep 1999 15:09:27 -0400 (EDT) (envelope-from michael@fam-meskes.de) Received: (from michael@localhost) by tanja.fam-meskes.de (8.9.3/8.9.3/Debian/GNU) id UAA01415 for pgsql-interfaces@postgresql.org; Mon, 27 Sep 1999 20:36:53 +0200 Date: Mon, 27 Sep 1999 20:36:52 +0200 From: Michael Meskes To: PostgreSQL Interfaces Subject: Re: [INTERFACES] Create a database with ecpg Message-ID: <19990927203652.A1373@fam-meskes.de> Mail-Followup-To: PostgreSQL Interfaces Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii User-Agent: Mutt/1.0pre2i 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!