mirror of
https://github.com/django/django.git
synced 2024-12-31 21:46:05 +00:00
Fixed #34873 -- Added QuerySet.explain() support for GENERIC_PLAN option on PostgreSQL 16+.
This commit is contained in:
parent
357365a64e
commit
f9e9526800
@ -134,6 +134,10 @@ class DatabaseFeatures(BaseDatabaseFeatures):
|
|||||||
def is_postgresql_15(self):
|
def is_postgresql_15(self):
|
||||||
return self.connection.pg_version >= 150000
|
return self.connection.pg_version >= 150000
|
||||||
|
|
||||||
|
@cached_property
|
||||||
|
def is_postgresql_16(self):
|
||||||
|
return self.connection.pg_version >= 160000
|
||||||
|
|
||||||
has_bit_xor = property(operator.attrgetter("is_postgresql_14"))
|
has_bit_xor = property(operator.attrgetter("is_postgresql_14"))
|
||||||
supports_covering_spgist_indexes = property(operator.attrgetter("is_postgresql_14"))
|
supports_covering_spgist_indexes = property(operator.attrgetter("is_postgresql_14"))
|
||||||
supports_unlimited_charfield = True
|
supports_unlimited_charfield = True
|
||||||
|
@ -31,6 +31,7 @@ class DatabaseOperations(BaseDatabaseOperations):
|
|||||||
"ANALYZE",
|
"ANALYZE",
|
||||||
"BUFFERS",
|
"BUFFERS",
|
||||||
"COSTS",
|
"COSTS",
|
||||||
|
"GENERIC_PLAN",
|
||||||
"SETTINGS",
|
"SETTINGS",
|
||||||
"SUMMARY",
|
"SUMMARY",
|
||||||
"TIMING",
|
"TIMING",
|
||||||
|
@ -3076,6 +3076,10 @@ adverse effects on your database. For example, the ``ANALYZE`` flag supported
|
|||||||
by MariaDB, MySQL 8.0.18+, and PostgreSQL could result in changes to data if
|
by MariaDB, MySQL 8.0.18+, and PostgreSQL could result in changes to data if
|
||||||
there are triggers or if a function is called, even for a ``SELECT`` query.
|
there are triggers or if a function is called, even for a ``SELECT`` query.
|
||||||
|
|
||||||
|
.. versionchanged:: 5.1
|
||||||
|
|
||||||
|
Support for the ``generic_plan`` option on PostgreSQL 16+ was added.
|
||||||
|
|
||||||
.. _field-lookups:
|
.. _field-lookups:
|
||||||
|
|
||||||
``Field`` lookups
|
``Field`` lookups
|
||||||
|
@ -168,7 +168,8 @@ Migrations
|
|||||||
Models
|
Models
|
||||||
~~~~~~
|
~~~~~~
|
||||||
|
|
||||||
* ...
|
* :meth:`.QuerySet.explain` now supports the ``generic_plan`` option on
|
||||||
|
PostgreSQL 16+.
|
||||||
|
|
||||||
Requests and Responses
|
Requests and Responses
|
||||||
~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
@ -85,6 +85,8 @@ class ExplainTests(TestCase):
|
|||||||
{"settings": True},
|
{"settings": True},
|
||||||
{"analyze": True, "wal": True},
|
{"analyze": True, "wal": True},
|
||||||
]
|
]
|
||||||
|
if connection.features.is_postgresql_16:
|
||||||
|
test_options.append({"generic_plan": True})
|
||||||
for options in test_options:
|
for options in test_options:
|
||||||
with self.subTest(**options), transaction.atomic():
|
with self.subTest(**options), transaction.atomic():
|
||||||
with CaptureQueriesContext(connection) as captured_queries:
|
with CaptureQueriesContext(connection) as captured_queries:
|
||||||
|
Loading…
Reference in New Issue
Block a user