From: Markus Schaber <schabi@logix-tt.com>
To: Kris Jurka <books@ejurka.com>
Cc: Giuseppe Sacco <giuseppe@eppesuigoccas.homedns.org>
Cc: pgsql-jdbc@postgresql.org <pgsql-jdbc@postgresql.org>
Subject: Re: DDL in transactions?
Date: Thu, 31 Mar 2005 19:34:14 +0200
Message-ID: <424C3496.4010506@logix-tt.com> (raw)
In-Reply-To: <Pine.BSO.4.56.0503311102060.12053@leary.csoft.net>
References: <1112254334.3881.8.camel@localhost>
<Pine.BSO.4.56.0503311102060.12053@leary.csoft.net>
Hi, Giuseppe,
Kris Jurka schrieb:
>>My question is: why? Shouldn't DDL be executed immediately?
>
> No. DDL in postgresql is fully transactable and may be rolled back or
> committed. That doesn't explain why the above code doesn't work.
> Because the two executeUpdates are on the same Statement on the same
> Connection the second execution should see the newly created table because
> it is in the same transaction. Perhaps you are not showing us the real
> code you are using and you actually have two connections?
You can simply try this out via psql:
lwgeom=# begin;
BEGIN
lwgeom=# create table tester (a int);
CREATE TABLE
lwgeom=# insert into tester values (1);
INSERT 281855490 1
lwgeom=# rollback;
ROLLBACK
lwgeom=# select * from tester;
ERROR: relation "tester" does not exist
lwgeom=#
HTH,
Markus
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: schabi@logix-tt.com, books@ejurka.com, giuseppe@eppesuigoccas.homedns.org
Subject: Re: DDL in transactions?
In-Reply-To: <424C3496.4010506@logix-tt.com>
References: <1112254334.3881.8.camel@localhost> <Pine.BSO.4.56.0503311102060.12053@leary.csoft.net> <424C3496.4010506@logix-tt.com>
* 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