@@ -137,42 +137,6 @@ def _record(self, method, sql, params):
137137 "template_info" : template_info ,
138138 }
139139
140- if vendor == "postgresql" :
141- # If an erroneous query was ran on the connection, it might
142- # be in a state where checking isolation_level raises an
143- # exception.
144- try :
145- iso_level = conn .isolation_level
146- except conn .InternalError :
147- iso_level = "unknown"
148- # PostgreSQL does not expose any sort of transaction ID, so it is
149- # necessary to generate synthetic transaction IDs here. If the
150- # connection was not in a transaction when the query started, and was
151- # after the query finished, a new transaction definitely started, so get
152- # a new transaction ID from logger.new_transaction_id(). If the query
153- # was in a transaction both before and after executing, make the
154- # assumption that it is the same transaction and get the current
155- # transaction ID from logger.current_transaction_id(). There is an edge
156- # case where Django can start a transaction before the first query
157- # executes, so in that case logger.current_transaction_id() will
158- # generate a new transaction ID since one does not already exist.
159- final_conn_status = conn .info .transaction_status
160- if final_conn_status == STATUS_IN_TRANSACTION :
161- if initial_conn_status == STATUS_IN_TRANSACTION :
162- trans_id = self .logger .current_transaction_id (alias )
163- else :
164- trans_id = self .logger .new_transaction_id (alias )
165- else :
166- trans_id = None
167-
168- kwargs .update (
169- {
170- "trans_id" : trans_id ,
171- "trans_status" : conn .info .transaction_status ,
172- "iso_level" : iso_level ,
173- }
174- )
175-
176140 # We keep `sql` to maintain backwards compatibility
177141 self .logger .record (** kwargs )
178142
0 commit comments