mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
Fixed #35021 -- Fixed capturing queries when using client-side parameters binding with psycopg 3+.
This commit is contained in:
committed by
Mariusz Felisiak
parent
177e649396
commit
4426b1a72d
@@ -105,6 +105,15 @@ class DatabaseFeatures(BaseDatabaseFeatures):
|
||||
},
|
||||
}
|
||||
)
|
||||
if self.uses_server_side_binding:
|
||||
skips.update(
|
||||
{
|
||||
"The actual query cannot be determined for server side bindings": {
|
||||
"backends.base.test_base.ExecuteWrapperTests."
|
||||
"test_wrapper_debug",
|
||||
}
|
||||
},
|
||||
)
|
||||
return skips
|
||||
|
||||
@cached_property
|
||||
|
||||
@@ -296,9 +296,14 @@ class DatabaseOperations(BaseDatabaseOperations):
|
||||
if is_psycopg3:
|
||||
|
||||
def last_executed_query(self, cursor, sql, params):
|
||||
try:
|
||||
return self.compose_sql(sql, params)
|
||||
except errors.DataError:
|
||||
if self.connection.features.uses_server_side_binding:
|
||||
try:
|
||||
return self.compose_sql(sql, params)
|
||||
except errors.DataError:
|
||||
return None
|
||||
else:
|
||||
if cursor._query and cursor._query.query is not None:
|
||||
return cursor._query.query.decode()
|
||||
return None
|
||||
|
||||
else:
|
||||
|
||||
@@ -89,6 +89,9 @@ class DatabaseFeatures(BaseDatabaseFeatures):
|
||||
"db_functions.math.test_round.RoundTests."
|
||||
"test_integer_with_negative_precision",
|
||||
},
|
||||
"The actual query cannot be determined on SQLite": {
|
||||
"backends.base.test_base.ExecuteWrapperTests.test_wrapper_debug",
|
||||
},
|
||||
}
|
||||
if self.connection.is_in_memory_db():
|
||||
skips.update(
|
||||
|
||||
Reference in New Issue
Block a user