Re: Unable to ALTER table after SELECT data from table

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: Unable to ALTER table after SELECT data from table
Дата
Msg-id 20071210212018.GA30444@svana.org
обсуждение исходный текст
Ответ на Unable to ALTER table after SELECT data from table  (Thomas Carsten Franke <Thomas-Carsten.Franke@brunel.de>)
Список 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@svana.org>   http://svana.org/kleptog/
> Those who make peaceful revolution impossible will make violent revolution inevitable.
>  -- John F Kennedy

Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: Raymond O'Donnell
Дата:
Сообщение: Re: Simpler dump?
Следующее
От: "Scott Marlowe"
Дата:
Сообщение: Re: Unable to ALTER table after SELECT data from table