On Fri, Aug 19, 2011 at 3:31 PM, Tom Lane <t...@sss.pgh.pa.us> wrote: >> 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.
I guess. It's totally inconsistent, though. COMMIT emits a WARNING, ROLLBACK emits a NOTICE, and SAVEPOINT and ROLLBACK TO SAVEPOINT emit FATAL. Maybe we should add some commands that throw PANIC and DEBUG1 just for good measure. The thing that really bothers me is that the way ROLLBACK rolls the transaction back, but only half-way. It would be reasonable for it to JUST emit a notice. And it would be reasonable for it to error out and abort the execution of the command string. But allowing the execution of the command string to continue while arranging for it to abort at the end is really pretty strange. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers