You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Move postgresql connection logic to NormalCursorWrapper._record()
Previously, the logic for determining when to switch transaction IDs
was contained in SQLPanel.get_transaction_id(). However, this was not
sufficient, as it only looked at the transaction status after the query
was finished. If two queries were issued consecutively but in separate
transactions, such as in the following:
with transaction.atomic():
list(User.objects.all())
with transaction.atomic():
list(Group.objects.all())
both queries would be given the same transaction ID since they would
both have the same transaction status after being executed
(TRANSACTION_STATUS_INTRANS). Instead, move the logic to
NormalCursorWrapper._record() and compare the transaction status before
the query to the transaction status after the query to determine if a
new transaction was started.
Also, use the conn.status attribute for determining transaction status
instead of conn.get_transaction_status(), since the former is a local
connection variable, while the latter requires a call to the server.
0 commit comments