[Dbix-class] how to implement Transactions (over different db tables) in a Catalyst project

Tomas Doran bobtfish at bobtfish.net
Tue Jul 7 10:34:19 GMT 2009


kakimoto at tpg.com.au wrote:
> 2) I noticed that whilst the rollback was successful. the sequence do
> not get rolled back. IS this desired behaviour of DBIx::Class?

This is a postgres thing, not a DBIC thing.

And no, sequences don't get rolled back.

Consider, imagining sequence starts at 1:
A: {start trans, INSERT ROW (seq 2)}
B: {start trans, INSERT ROW (seq 3)}
Seq is now 3
B: {commit}
A: {rollback}?

If you roll the sequence back 1 as A rolled back, the sequence is 2, so 
when you next insert you have a duplicate seq (as B is committed).

Couldn't work, without keeping track of which previous sequence values 
had been rolled back. It'd also not be a sequence if you could ask for 
two values and the second was lower than the first :)

Cheers
t0m



More information about the DBIx-Class mailing list