psql swallowed my "BEGIN;" on reset... user beware?

From: Ken Tanzer <ken(dot)tanzer(at)gmail(dot)com>
To: PG-General Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: psql swallowed my "BEGIN;" on reset... user beware?
Date: 2013-09-29 06:18:05
Message-ID: CAD3a31U+fSBsq=txw2G-D+fPND_UN-nSojrGyaD+hkYUzvxusQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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
*http://agency-software.org/*
ken(dot)tanzer(at)agency-software(dot)org
(253) 245-3801

Subscribe to the mailing
list<agency-general-request(at)lists(dot)sourceforge(dot)net?body=subscribe>
to
learn more about AGENCY or
follow the discussion.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2013-09-29 09:33:56 Re: Building with MinGW issue
Previous Message Muhammad Bashir Al-Noimi 2013-09-29 05:09:40 Re: Building with MinGW issue