summaryrefslogtreecommitdiff
path: root/django/db/backends/postgresql/features.py
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2020-10-06 12:51:35 +0200
committerGitHub <noreply@github.com>2020-10-06 12:51:35 +0200
commit999cddd58d30469f3ee85278985313fdf528323d (patch)
tree81230701f3d93bfb7be29b284eebe8b5123d9f89 /django/db/backends/postgresql/features.py
parent143d8e1ab3b7097c7d2bdf77096b96739b6239c6 (diff)
downloaddjango-999cddd58d30469f3ee85278985313fdf528323d.tar.gz
Fixed #32073 -- Skipped collation tests on PostgreSQL < 10.
PostgreSQL < 10 doesn't support ICU collations. Thanks Hannes Ljungberg for the report.
Diffstat (limited to 'django/db/backends/postgresql/features.py')
-rw-r--r--django/db/backends/postgresql/features.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/django/db/backends/postgresql/features.py b/django/db/backends/postgresql/features.py
index e70ef4e95d..7615c2b4c3 100644
--- a/django/db/backends/postgresql/features.py
+++ b/django/db/backends/postgresql/features.py
@@ -58,10 +58,16 @@ class DatabaseFeatures(BaseDatabaseFeatures):
supports_deferrable_unique_constraints = True
has_json_operators = True
json_key_contains_list_matching_requires_list = True
- test_collations = {
- 'non_default': 'sv-x-icu',
- 'swedish_ci': 'sv-x-icu',
- }
+
+ @cached_property
+ def test_collations(self):
+ # PostgreSQL < 10 doesn't support ICU collations.
+ if self.is_postgresql_10:
+ return {
+ 'non_default': 'sv-x-icu',
+ 'swedish_ci': 'sv-x-icu',
+ }
+ return {}
@cached_property
def introspected_field_types(self):