Fixed cached_properties that share a common property.

The aliases aren't cached and thus the old usage will be an error after
refs #29478.
This commit is contained in:
Sergey Fedoseev 2018-11-16 20:25:26 +05:00 committed by Tim Graham
parent 11bcb57ee2
commit 80ba7a881f
3 changed files with 17 additions and 13 deletions

View file

@ -1,3 +1,5 @@
import operator
from django.db.backends.base.features import BaseDatabaseFeatures
from django.db.utils import InterfaceError
from django.utils.functional import cached_property
@ -64,10 +66,10 @@ class DatabaseFeatures(BaseDatabaseFeatures):
def is_postgresql_10(self):
return self.connection.pg_version >= 100000
has_select_for_update_skip_locked = is_postgresql_9_5
has_brin_index_support = is_postgresql_9_5
has_jsonb_agg = is_postgresql_9_5
has_brin_autosummarize = is_postgresql_10
has_gin_pending_list_limit = is_postgresql_9_5
supports_ignore_conflicts = is_postgresql_9_5
has_phraseto_tsquery = is_postgresql_9_6
has_select_for_update_skip_locked = property(operator.attrgetter('is_postgresql_9_5'))
has_brin_index_support = property(operator.attrgetter('is_postgresql_9_5'))
has_jsonb_agg = property(operator.attrgetter('is_postgresql_9_5'))
has_brin_autosummarize = property(operator.attrgetter('is_postgresql_10'))
has_gin_pending_list_limit = property(operator.attrgetter('is_postgresql_9_5'))
supports_ignore_conflicts = property(operator.attrgetter('is_postgresql_9_5'))
has_phraseto_tsquery = property(operator.attrgetter('is_postgresql_9_6'))