mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-22 00:46:33 +03:00
Improve wording around transactions behaviour closing connections
The transaction is not rolled back by the connection, rather discarded by the server. Close #1135.
This commit is contained in:
parent
0ee9d840a1
commit
195b254937
|
@ -750,10 +750,14 @@ until a call to the `~connection.rollback()` method.
|
|||
|
||||
The connection is responsible for terminating its transaction, calling either
|
||||
the `~connection.commit()` or `~connection.rollback()` method. Committed
|
||||
changes are immediately made persistent into the database. Closing the
|
||||
connection using the `~connection.close()` method or destroying the
|
||||
connection object (using `!del` or letting it fall out of scope)
|
||||
will result in an implicit rollback.
|
||||
changes are immediately made persistent into the database. If he connection
|
||||
is closed (using the `~connection.close()` method) or destroyed (using `!del`
|
||||
or letting it falling out of scope) while a transaction is in progress, the
|
||||
server will discard the transaction. However doing so is not adviceable:
|
||||
middleware such as PgBouncer_ may see the connection closed uncleanly and
|
||||
dispose of it.
|
||||
|
||||
.. _PgBouncer: http://www.pgbouncer.org/
|
||||
|
||||
It is possible to set the connection in *autocommit* mode: this way all the
|
||||
commands executed will be immediately committed and no rollback is possible. A
|
||||
|
|
Loading…
Reference in New Issue
Block a user