diff options
| author | Jacob Walls <jacobtylerwalls@gmail.com> | 2025-01-25 12:06:11 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-25 18:06:11 +0100 |
| commit | 330d89d4fe7832355535580383523f1749a3ee45 (patch) | |
| tree | 1250a5e8aede8704e3b6661e4a023808f9ae2e86 /tests/backends | |
| parent | 9cc3970eaaf603832c075618e61aea9ea430f719 (diff) | |
Fixed #36111 -- Fixed test --debug-sql crash on Oracle when no prior query has executed.
Diffstat (limited to 'tests/backends')
| -rw-r--r-- | tests/backends/tests.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/backends/tests.py b/tests/backends/tests.py index 0349e47272..4ba961bfc1 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): qs = Reporter.objects.filter(first_name="test") |
