Disallow use of wrong transactions

We don't want to allow statements to outlive the active transaction in
which they were prepared.