On Thu, Sep 27, 2012 at 08:40:13PM +0000, Marcin Cieslak wrote:
From the PostgreSQL side I see one problem with nesting - we are already using savepoints to emulate MySQL's "INSERT IGNORE" and friends.\ It might be difficult to abuse that feature for something more than this. There is a class "SavepointPostgres" which is used for that.
As long as the savepoints are properly nested and multiple levels of nesting don't try to reuse the same name, things should be fine. And since this use is just "SAVEPOINT", "INSERT", "RELEASE SAVEPOINT", there's no opportunity for things to not be properly nested, and avoiding name collision would not be hard.
BTW, it looks to me like the use of SavepointPostgres in "INSERT IGNORE" emulation will build up unreleased savepoints whenever an insert is ignored, because $savepoint->rollback() does not actually release the savepoint. But this shouldn't cause trouble beyond wasting resources to store all those savepoints.