psql swallowed my "BEGIN;" on reset... user beware? - Mailing list pgsql-general

From Ken Tanzer
Subject psql swallowed my "BEGIN;" on reset... user beware?
Date
Msg-id CAD3a31U+fSBsq=txw2G-D+fPND_UN-nSojrGyaD+hkYUzvxusQ@mail.gmail.com
Whole thread Raw
Responses Re: psql swallowed my "BEGIN;" on reset... user beware?  (Moshe Jacobson <moshe@neadwerx.com>)
List pgsql-general
After restarting the server in another window, I was surprised that my command did not run in a transaction:

spc_test_scratch=# BEGIN; DROP VIEW IF EXISTS ptest_mip ; DROP VIEW rent_info; \i create.view.rent_info.sql
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.
NOTICE:  view "ptest_mip" does not exist, skipping
DROP VIEW
DROP VIEW
CREATE VIEW
spc_test_scratch=# commit;
WARNING:  there is no transaction in progress
COMMIT

It looks like the behavior makes perfect sense--the "BEGIN;" failed, the server reset, psql continued processing commands.  It seems a little dangerous, though.  In my case I could/should have known, but a user could easily have no way of knowing if their server was reset by an admin.  And of course "BEGIN;" is an unusually likely candidate for first command in a series.

Is this the desired behavior, or would it be better to abort the commands at this point?

Ken



--
AGENCY Software  
A data system that puts you in control
100% Free Software
(253) 245-3801

learn more about AGENCY or
follow the discussion.

pgsql-general by date:

Previous
From: Muhammad Bashir Al-Noimi
Date:
Subject: Re: Building with MinGW issue
Next
From: Martijn van Oosterhout
Date:
Subject: Re: Building with MinGW issue