Re: failed commit question

From: yamt(at)mwd(dot)biglobe(dot)ne(dot)jp (YAMAMOTO Takashi)
To: chetan(dot)suttraway(at)enterprisedb(dot)com
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: failed commit question
Date: 2011-02-18 01:53:06
Message-ID: 20110218015306.48F8619CE65@mail.netbsd.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

hi,

> On Thu, Feb 10, 2011 at 2:22 PM, YAMAMOTO Takashi <yamt(at)mwd(dot)biglobe(dot)ne(dot)jp>wrote:
>
>> hi,
>>
>> when COMMIT failed, does it leave the transaction opened
>> (thus ROLLBACK is necessary) ?
>>
>
> The transaction is marked for rollback.
>
> check this discussion:
> http://archives.postgresql.org/pgsql-jdbc/2005-01/msg00117.php

thanks.

it seems that the discussion is about a COMMIT after a failure of other
preceding commands in the transaction, right? i'm not sure as i'm not
familiar with java or jdbc.

my question was about a failed COMMIT. sorry if it was unclear.
for example, when a COMMIT failed due to a serialization error.
after posting the previous mail, i realized the way to trigger the
case and actually tried it. it seems that it terminates the transaction
even on the error. thus no need to rollback.

so i have a new question; is it safe to assume that it's same for any other
possible errors or should i consult PQtransactionStatus?

hoge=# commit;
ERROR: could not serialize access due to read/write dependencies among transactions
DETAIL: Cancelled on identification as a pivot, during commit attempt.
HINT: The transaction might succeed if retried.
hoge=# rollback;
NOTICE: there is no transaction in progress
ROLLBACK
hoge=#

>
> Tip: always try to dig up the archives for similar issues, before posting.

i asked google before posting, but failed to find an answer.
anyway, thanks for the tip.

YAMAMOTO Takashi

>
>
>
> --
> Chetan Sutrave
> http://www.enterprisedb.com

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message chris chris 2011-02-18 16:52:31 Help loading data. Error code page 850
Previous Message Tom Lane 2011-02-17 19:32:09 Re: even after laboriously following previous post, cannot cast from char to int