summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJacob Walls <jacobtylerwalls@gmail.com>2025-01-25 12:06:11 -0500
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2025-01-25 18:07:26 +0100
commite9576c0aa86186e25b92c3c4f6b1bd7f20799db9 (patch)
tree368dbc3d10671acbbafb07d6cf6c9eca7ec0e0ef /tests
parent93e18a87dd66caee80d033ae97fde65eea26cf5a (diff)
[5.2.x] Fixed #36111 -- Fixed test --debug-sql crash on Oracle when no prior query has executed.
Backport of 330d89d4fe7832355535580383523f1749a3ee45 from main
Diffstat (limited to 'tests')
-rw-r--r--tests/backends/tests.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/backends/tests.py b/tests/backends/tests.py
index 2adfa51360..d0af6e49f0 100644
--- a/tests/backends/tests.py
+++ b/tests/backends/tests.py
@@ -73,8 +73,14 @@ class LastExecutedQueryTest(TestCase):
last_executed_query should not raise an exception even if no previous
query has been run.
"""
+ suffix = connection.features.bare_select_suffix
with connection.cursor() as cursor:
+ if connection.vendor == "oracle":
+ cursor.statement = None
+ # No previous query has been run.
connection.ops.last_executed_query(cursor, "", ())
+ # Previous query crashed.
+ connection.ops.last_executed_query(cursor, "SELECT %s" + suffix, (1,))
def test_debug_sql(self):
list(Reporter.objects.filter(first_name="test"))