summaryrefslogtreecommitdiff
path: root/tests/queries
diff options
context:
space:
mode:
authorAdam Johnson <me@adamj.eu>2024-03-13 18:10:54 +0000
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2024-03-15 06:58:14 +0100
commitcbf1e87398a58737e27e1b680283903caf661f90 (patch)
tree59cdd948fb7d18fe52bf74e59278d63208e22e4f /tests/queries
parent593067a8ee43e2167c5ffc92e3cc3c5e40ec4aa4 (diff)
Fixed #35294 -- Fixed TEXT format of QuerySet.explain() for long plans.
co-authored-by: Gordon <gordon.wrigley@gmail.com> co-authored-by: Simon Charette <charette.s@gmail.com>
Diffstat (limited to 'tests/queries')
-rw-r--r--tests/queries/test_explain.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/queries/test_explain.py b/tests/queries/test_explain.py
index 980e8e9621..44689aedf8 100644
--- a/tests/queries/test_explain.py
+++ b/tests/queries/test_explain.py
@@ -96,6 +96,15 @@ class ExplainTests(TestCase):
option = "{} {}".format(name.upper(), "true" if value else "false")
self.assertIn(option, captured_queries[0]["sql"])
+ def test_multi_page_text_explain(self):
+ if "TEXT" not in connection.features.supported_explain_formats:
+ self.skipTest("This backend does not support TEXT format.")
+
+ base_qs = Tag.objects.order_by()
+ qs = base_qs.filter(name="test").union(*[base_qs for _ in range(100)])
+ result = qs.explain(format="text")
+ self.assertGreaterEqual(result.count("\n"), 100)
+
def test_option_sql_injection(self):
qs = Tag.objects.filter(name="test")
options = {"SUMMARY true) SELECT 1; --": True}