Nested transactions for postgres

I need to support nested transactions for postgres.

A `begin` from a transaction will start a savepoint with a random name.
A `rollback` from a nested transaction will rollback to the savepoint.
A `commit` from a nested transaction will release the savepoint.

(I'm not sure this is the best way to implement it, I'd appretiate any feedback/comment about it)