Sujet : Re: psycopg2 positioning of .commit() (Posting On Python-List Prohibited)
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.lang.pythonDate : 08. Sep 2024, 22:48:16
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vbl2ig$222n3$2@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10
User-Agent : Pan/0.160 (Toresk; )
On Sun, 8 Sep 2024 11:03:21 -0000 (UTC), Jon Ribbens wrote:
What if there's an exception in your exception handler? I'd put the
rollback in the 'finally' handler, so it's always called. If you've
already called 'commit' then the rollback does nothing of course.
In any DBMS worth its salt, rollback is something that happens
automatically if the transaction should fail to complete for any reason.
This applies for any failure reason, up to and including a program or
system crash.