Re: failed commit question - Mailing list pgsql-novice

From yamt@mwd.biglobe.ne.jp (YAMAMOTO Takashi)
Subject Re: failed commit question
Date
Msg-id 20110218015306.48F8619CE65@mail.netbsd.org
Whole thread Raw
In response to Re: failed commit question  (Chetan Suttraway <chetan.suttraway@enterprisedb.com>)
List pgsql-novice
hi,

> On Thu, Feb 10, 2011 at 2:22 PM, YAMAMOTO Takashi <yamt@mwd.biglobe.ne.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

pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: even after laboriously following previous post, cannot cast from char to int
Next
From: chris chris
Date:
Subject: Help loading data. Error code page 850