From: | Nicholas Rahn <nicholas(dot)rahn(at)mnc(dot)ch> |
---|---|
To: | Tim McAuley <mcauleyt(at)tcd(dot)ie> |
Cc: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: create table inside a transaction |
Date: | 2003-09-29 15:49:53 |
Message-ID: | 1064850593.1865.83.camel@frisbee.mnc.ch |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Hi,
I ran into this same error last week. My very inelegant solution was
this:
<!-- Create the database. -->
<exec executable="/usr/local/pgsql/bin/createdb"
failonerror="true">
<arg value="-E"/>
<arg value="UNICODE"/>
<arg value="-U"/>
<arg value="postgres"/>
<arg value="mydb"/>
</exec>
But, it would be nice to have something a bit "cleaner".
Nick
On Mon, 2003-09-29 at 16:27, Tim McAuley wrote:
> 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
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faqs/FAQ.html
>
From | Date | Subject | |
---|---|---|---|
Next Message | Barry Lind | 2003-09-29 16:35:36 | Re: problem with setting boolean value on |
Previous Message | Tim McAuley | 2003-09-29 14:27:32 | create table inside a transaction |