I would love to see autonomous transactions in core. I just have one major concern, but thankfully it's easily addressed.
There should be a way to within the session and/or txn permanently block autonomous transactions. This is important if you as a caller function want to be sure none of the work made by anything called down the stack gets committed. That is, if you as a caller decide to rollback, e.g. by raising an exception, and you want to be sure *everything* gets rollbacked, including all work by functions you've called. If the caller can't control this, then the author of the caller function would need to inspect the source code of all function being called, to be sure there are no code using autonomous transactions. Coding conventions, rules and discipline are all good and will help against misuse of the feature, but some day someone will make a mistake and wrongly use the autonomous transaction and cause unwanted unknown side-effect I as a caller function didn't expect or know about. Once you have blocked autonomous transactions in a session or txn, then any function called must not be able to unblock it (in the session or txn), otherwise it defeats the purpose. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers