PSQL undesired transaction behavior when connection is lost. - Mailing list pgsql-general

From Mike Benoit
Subject PSQL undesired transaction behavior when connection is lost.
Date
Msg-id 1097174870.9273.8.camel@ipso.snappymail.ca
Whole thread Raw
Responses Re: PSQL undesired transaction behavior when connection is lost.
List pgsql-general
I assume I'm not the first person to run in to this, however searching
google didn't seem to come up with anything useful.

its=> begin; delete from pay_stub_entry where pay_stub_id in (select id
from pay_stub where created_date >= 1096527603 order by created_date
desc); delete from pay_stub where id in (select id from pay_stub where
created_date >= 1096527603 order by created_date desc); commit;

FATAL:  terminating connection due to administrator command
server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.
The connection to the server was lost. Attempting reset: Succeeded.
DELETE 274
DELETE 19
WARNING:  there is no transaction in progress
COMMIT

its=> select version();
                                                 version
----------------------------------------------------------------------------------------------------------
 PostgreSQL 7.4.5 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.4.1
(Mandrakelinux (Alpha 3.4.1-3mdk)
(1 row)

On connection reset, shouldn't "begin;" be sent again? Either that or
shouldn't the entire command fail in this case, not just the begin?

If I had a syntax error in the first delete command, I definitely would
not want the second delete to succeed, which had the potential to happen
in the above case. (Luckily it didn't)


BTW: I had restarted the server manually, so it didn't crash or
anything.

--
Mike Benoit <ipso@snappymail.ca>


pgsql-general by date:

Previous
From: Artem Litvinovich
Date:
Subject: 8.0 questions
Next
From: Bruce Momjian
Date:
Subject: Re: European dates with Win32 version