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

From Ken Tanzer
Subject Re: psql swallowed my "BEGIN;" on reset... user beware?
Date
Msg-id CAD3a31XtkWNFnzPHHfasZFDTZPyVTp-nFxaTEX-bYR2DwH1nTw@mail.gmail.com
Whole thread Raw
In response to Re: psql swallowed my "BEGIN;" on reset... user beware?  (Merlin Moncure <mmoncure@gmail.com>)
List pgsql-general
you can control this with on error stop directive -- add it to your
psqlrc if you want the setting to persist.

I hear what you're saying, but wonder about the implications:

It sounds like you can't trust your BEGIN to actually start a transaction unless on_error_stop is set

The default for on_error_stop seems to be off, so at a minimum this is a default gotcha waiting to happen.  At the very least, perhaps the documentation for BEGIN and ON_ERROR_STOP should mention this?

Should BEGIN be a special case?  The operator clearly wants the subsequent commands to run together or not at all.  I'm having trouble imagining any scenario under which one would want their commands to continue after a failed BEGIN, especially if it happens at random times outside of one's control.

Is your response based on belief that the current behavior is good, or a concern about changing the way psql works, or undesired side effects from changing it?  I could understand any of those--just curious what your thinking is!

Cheers,
Ken

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Inconsistent behavior with unnamed columns
Next
From: akp geek
Date:
Subject: Postgres replication question :- One master 2 slaves 9.0.10