create table inside a transaction

From: Tim McAuley <mcauleyt(at)tcd(dot)ie>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: create table inside a transaction
Date: 2003-09-29 14:27:32
Message-ID: 3F784154.1010503@tcd.ie
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Nicholas Rahn 2003-09-29 15:49:53 Re: create table inside a transaction
Previous Message Stuart M Easterling 2003-09-29 14:24:07 Re: problem with setting boolean value on