Refs #30897 -- Added test for SETTINGS option to Queryset.explain() on PostgreSQL 12+.

This commit is contained in:
Nick Pope 2019-10-22 09:31:41 +01:00 committed by Mariusz Felisiak
parent a5c5ae7d91
commit 6e9189c080
2 changed files with 6 additions and 0 deletions

View File

@ -64,6 +64,10 @@ class DatabaseFeatures(BaseDatabaseFeatures):
def is_postgresql_10(self): def is_postgresql_10(self):
return self.connection.pg_version >= 100000 return self.connection.pg_version >= 100000
@cached_property
def is_postgresql_12(self):
return self.connection.pg_version >= 120000
has_brin_autosummarize = property(operator.attrgetter('is_postgresql_10')) has_brin_autosummarize = property(operator.attrgetter('is_postgresql_10'))
has_phraseto_tsquery = property(operator.attrgetter('is_postgresql_9_6')) has_phraseto_tsquery = property(operator.attrgetter('is_postgresql_9_6'))
supports_table_partitions = property(operator.attrgetter('is_postgresql_10')) supports_table_partitions = property(operator.attrgetter('is_postgresql_10'))

View File

@ -58,6 +58,8 @@ class ExplainTests(TestCase):
] ]
if connection.features.is_postgresql_10: if connection.features.is_postgresql_10:
test_options.append({'summary': True}) test_options.append({'summary': True})
if connection.features.is_postgresql_12:
test_options.append({'settings': 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: