Re: Error on failed COMMIT - Mailing list pgsql-hackers

From Vladimir Sitnikov
Subject Re: Error on failed COMMIT
Date
Msg-id CAB=Je-HV4Pm8Wt_KuLyEEOVMNsGX3UEY5zH-S1c9jd7CKx8pgA@mail.gmail.com
Whole thread Raw
In response to Re: Error on failed COMMIT  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Error on failed COMMIT  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Robert>Now, of course, it's also true that if what the server does makes
Robert>users sad, maybe the server should do something different

The server makes users sad as it reports the same end result (=="commit failed") differently.
Sometimes the server produces ERROR, and sometimes the server produces "OK, the transaction was rolled back".

The users do expect that commit might fail, and they don't really expect that sometimes commit can be silently converted to a rollback.

Robert>BEGIN;
Robert>-- do stuff
Robert>COMMIT;
Robert>BEGIN;
Robert>-- do more stuff
Robert>COMMIT;

Robert>...and they run these scripts by piping them into psql. Now, if the
Robert>COMMIT leaves the session in a transaction state,

Noone suggested that "commit leaves the session in a transaction state".
Of course, every commit should terminate the transaction.
However, if a commit fails (for any reason), it should produce the relevant ERROR that explains what went wrong rather than silently doing a rollback.

Vladimir

pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: plan cache overhead on plpgsql expression
Next
From: Antonin Houska
Date:
Subject: RS_EPHEMERAL vs RS_TEMPORARY