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.