create table inside a transaction - Mailing list pgsql-jdbc

From Tim McAuley
Subject create table inside a transaction
Date
Msg-id 3F784154.1010503@tcd.ie
Whole thread Raw
Responses Re: create table inside a transaction  (Nicholas Rahn <nicholas.rahn@mnc.ch>)
List pgsql-jdbc
Hi,

I am testing out Postgresql 7.4 beta3 (with appropriate jdbc driver) and
have come across an interesting little problem.

According to some comments on the web, statements such as "CREATE TABLE"
should not be run within a transaction. However, it is this very
statement that I am running from an sql ant task and I get the following
error:

BUILD FAILED
build.xml:257: org.postgresql.util.PSQLException: ERROR: CREATE DATABASE
cannot run inside a transaction block

Any ideas how to overcome this? My thoughts are:

- This message has obviously been upgraded to through an error in 7.4
- The sql call in the ant task is not in a <transaction> element.
    - however, ant will still place all the sql code in a single
transaction.

To overcome this I think the options are:
1 Modify ant code so that an sql ant task can be called without using a
transaction at all.
2 Ensure postgresql does not through this as an error (or the jdbc driver?)
3 Create own code (or ant task) that can run sql commands without using
transactions.

Just wondering what other people have done and what may be seen as the
best solution. Personally I would like if Ant had the option to disable
transactions altogether. This would seem the neatest and most "correct"
option.

All the best,

Tim


pgsql-jdbc by date:

Previous
From: "Stuart M Easterling"
Date:
Subject: Re: problem with setting boolean value on
Next
From: Nicholas Rahn
Date:
Subject: Re: create table inside a transaction