Interesting question. The latest code for db_transaction says:
Multiple db_transaction
s may be nested (end transaction
is transparently ns_db dml'ed when the outermost transaction
completes).
So, I believe that means that any nested db_transactions are
effectively converted into one big flat transaction.
Has anyone thought about making nested db_transactions instead set
savepoints, so that if an inner transaction aborts it rolls back to
the savepoint, rather than aborting all the outer db_transactions as
well? I know that should be possible in Oracle (whether it's a
good idea or not is another question), but does Postgres
have savepoints?