summaryrefslogtreecommitdiff
path: root/django/db/backends
diff options
context:
space:
mode:
authorTom <tom@tomforb.es>2017-04-22 16:44:51 +0100
committerTim Graham <timograham@gmail.com>2017-08-12 17:58:28 -0400
commitb78d100fa62cd4fbbc70f2bae77c192cb36c1ccd (patch)
treebe1f272298c15c6a261e33dff7486b0c3727b407 /django/db/backends
parent489421b01562494ab506de5d30ea97d7b6b5df30 (diff)
Fixed #27849 -- Added filtering support to aggregates.
Diffstat (limited to 'django/db/backends')
-rw-r--r--django/db/backends/base/features.py4
-rw-r--r--django/db/backends/postgresql/features.py4
2 files changed, 8 insertions, 0 deletions
diff --git a/django/db/backends/base/features.py b/django/db/backends/base/features.py
index 7626595741..22c2990e77 100644
--- a/django/db/backends/base/features.py
+++ b/django/db/backends/base/features.py
@@ -229,6 +229,10 @@ class BaseDatabaseFeatures:
supports_select_difference = True
supports_slicing_ordering_in_compound = False
+ # Does the database support SQL 2003 FILTER (WHERE ...) in aggregate
+ # expressions?
+ supports_aggregate_filter_clause = False
+
# Does the backend support indexing a TextField?
supports_index_on_text_field = True
diff --git a/django/db/backends/postgresql/features.py b/django/db/backends/postgresql/features.py
index 647fb9dc7f..3c7a7af80f 100644
--- a/django/db/backends/postgresql/features.py
+++ b/django/db/backends/postgresql/features.py
@@ -51,6 +51,10 @@ class DatabaseFeatures(BaseDatabaseFeatures):
$$ LANGUAGE plpgsql;"""
@cached_property
+ def supports_aggregate_filter_clause(self):
+ return self.connection.pg_version >= 90400
+
+ @cached_property
def has_select_for_update_skip_locked(self):
return self.connection.pg_version >= 90500