$self->_do_query('SET CONSTRAINTS ALL DEFERRED');
return preserve_context {
+ my $inner_self = $self; # avoid nested closure leak on 5.8
my $sg = Scope::Guard->new(sub {
- $self->_do_query('SET CONSTRAINTS ALL IMMEDIATE');
+ $inner_self->_do_query('SET CONSTRAINTS ALL IMMEDIATE');
});
$sub->()
} after => sub { $txn_scope_guard->commit };