Thread: failed commit question

failed commit question

From
yamt@mwd.biglobe.ne.jp (YAMAMOTO Takashi)
Date:
hi,

when COMMIT failed, does it leave the transaction opened
(thus ROLLBACK is necessary) ?

YAMAMOTO Takashi

Re: failed commit question

From
Chetan Suttraway
Date:


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

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



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

Re: failed commit question

From
yamt@mwd.biglobe.ne.jp (YAMAMOTO Takashi)
Date:
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