diff options
| author | Anthony Joseph <ajosephau@users.noreply.github.com> | 2024-10-23 22:13:18 +1100 |
|---|---|---|
| committer | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> | 2024-10-30 15:54:48 +0100 |
| commit | 3a8f52fbc6fe2ff646a2da4165497d82117e4a92 (patch) | |
| tree | b2f496aadef5091699c8305ba52edc71a88e5a78 /tests | |
| parent | 97a6a678c406b0049bd17bcd34f1d71d96141994 (diff) | |
Fixed #35856 -- Added QuerySet.explain() support for MEMORY/SERIALIZE option on PostgreSQL 17+.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/queries/test_explain.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/queries/test_explain.py b/tests/queries/test_explain.py index 67440cb502..95ca913cfc 100644 --- a/tests/queries/test_explain.py +++ b/tests/queries/test_explain.py @@ -90,13 +90,24 @@ class ExplainTests(TestCase): ] if connection.features.is_postgresql_16: test_options.append({"generic_plan": True}) + if connection.features.is_postgresql_17: + test_options.append({"memory": True}) + test_options.append({"serialize": "TEXT", "analyze": True}) + test_options.append({"serialize": "text", "analyze": True}) + test_options.append({"serialize": "BINARY", "analyze": True}) + test_options.append({"serialize": "binary", "analyze": True}) for options in test_options: with self.subTest(**options), transaction.atomic(): with CaptureQueriesContext(connection) as captured_queries: qs.explain(format="text", **options) self.assertEqual(len(captured_queries), 1) for name, value in options.items(): - option = "{} {}".format(name.upper(), "true" if value else "false") + if isinstance(value, str): + option = "{} {}".format(name.upper(), value.upper()) + else: + option = "{} {}".format( + name.upper(), "true" if value else "false" + ) self.assertIn(option, captured_queries[0]["sql"]) @skipUnlessDBFeature("supports_select_union") |
