From: | Martijn van Oosterhout <kleptog(at)svana(dot)org> |
---|---|
To: | Thomas Carsten Franke <Thomas-Carsten(dot)Franke(at)brunel(dot)de> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Unable to ALTER table after SELECT data from table |
Date: | 2007-12-10 21:20:18 |
Message-ID: | 20071210212018.GA30444@svana.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Mon, Dec 10, 2007 at 08:13:09PM +0100, Thomas Carsten Franke wrote:
> If I do so I get following error by Postgres:
>
> org.postgresql.util.PSQLException: ERROR: current transaction is
> aborted, commands ignored until end of transaction block
It means exactly what it says. You (or Java for you) started a
transaction block and everything in a transaction block is either
committed or aborted. Once an error has been raised, everything after
that is ignore till the end of the transaction.
> To work around this I add an dbCon.rollBack() after select statement
> above in good and in bad times. After that ALTER works.
> Can someone explain me why I need this rollback ?
Rollback/commit either will do. You just need ot start a new
transaction. What people usually do is to do stuff like what you're
doing outside any transactions, thus avoiding the whole problem.
Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Those who make peaceful revolution impossible will make violent revolution inevitable.
> -- John F Kennedy
From | Date | Subject | |
---|---|---|---|
Next Message | Scott Marlowe | 2007-12-10 21:27:52 | Re: Unable to ALTER table after SELECT data from table |
Previous Message | Keary Suska | 2007-12-10 20:48:33 | Re: Unable to ALTER table after SELECT data from table |