Robert Haas <robertmhaas@gmail.com> writes:
> I spent some time looking at this afternoon and it appears that the
> root of this problem is that we're a bit schizophrenic about whether a
> multi-query command string constitutes a transaction or not.
Yeah. The current behavior sort of automatically adds a BEGIN and a
COMMIT around the string, but it's evidently not tied into the real
BEGIN and COMMIT commands well enough.
> As for ROLLBACK, I think it should chuck an error instead of doing
> this funny emit-a-warning-and-silently-arrange-for-the-transaction-to-be-aborted-later
> thing.
I'm pretty unexcited about changing the behavior of established
mainstream cases just so that we can throw slightly-more-meaningful
errors in the psql -c case. ROLLBACK when not in a transaction is not
an error, only a NOTICE, and it should stay that way. If you change
that there are going to be a lot of application and driver authors on
your doorstep with the usual equipment.
regards, tom lane