Re: Unable to ALTER table after SELECT data from table

From: Keary Suska <hierophant(at)pcisys(dot)net>
To: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Unable to ALTER table after SELECT data from table
Date: 2007-12-10 20:48:33
Message-ID: C382F431.1AA90%hierophant@pcisys.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

on 12/10/07 12:15 PM, Thomas-Carsten(dot)Franke(at)brunel(dot)de purportedly said:

> 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 ?

You only need the rollback when the SELECT statement fails. When an error
occurs within a transaction, the transaction is aborted but not rolled back.
There are likely reasons why the rollback isn't automatic, but I don't know
them.

Your choice is either to run the commands in an "autocommit" mode or, as you
are doing, rollback (or commit, if there was no error) after the SELECT.

Best,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2007-12-10 21:20:18 Re: Unable to ALTER table after SELECT data from table
Previous Message jzhang2004@sbcglobal.net 2007-12-10 20:41:40 VTD-XML Tutorial by Code Examples Posted Options