PSQL undesired transaction behavior when connection is lost.

From: Mike Benoit <ipso(at)snappymail(dot)ca>
To: pgsql-general(at)postgresql(dot)org
Subject: PSQL undesired transaction behavior when connection is lost.
Date: 2004-10-07 18:47:50
Message-ID: 1097174870.9273.8.camel@ipso.snappymail.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)snappymail(dot)ca>

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ron St-Pierre 2004-10-07 18:47:57 Re: Conditional Relationships?
Previous Message Ron St-Pierre 2004-10-07 18:10:29 Re: Conditional Relationships?