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 23:17:54
Message-ID: C3831732.1AABD%hierophant@pcisys.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

on 12/10/07 2:27 PM, scott(dot)marlowe(at)gmail(dot)com 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.
>
> I think you confuse postgresql with some other database. Without
> setting a savepoint, any error during a transaction and roll it back
> upon connection close | rollback | commit.
>
> I.e. the rollback IS automatic. Just not necessarily immediate.

I suppose this clarification is useful for posterity, but or the record, I
as using the term "automatic" to address the apparent expectations of the
OP, and not to the ultimate behavior of postgresql

Best,

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2007-12-10 23:50:58 Re: partitioned table query question
Previous Message Richard Broersma Jr 2007-12-10 23:15:50 Re: SQL design pattern for a delta trigger?