From 92acf1022fb13a7a8b1ff7cdfe72c21050c1e4e7 Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Thu, 14 May 2020 15:07:08 +0200 Subject: [3.0.x] Fixed #31584 -- Fixed crash when chaining values()/values_list() after Exists() annotation and aggregation on Oracle. Oracle requires the EXISTS expression to be wrapped in a CASE WHEN in the GROUP BY clause. Regression in efa1908f662c19038a944129c81462485c4a9fe8. Backport of 3a941230c85b2702a5e1cd97e17251ce21057efa from master --- django/db/models/sql/compiler.py | 1 + 1 file changed, 1 insertion(+) (limited to 'django/db/models/sql/compiler.py') diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py index 18365f1d75..ccec6fdc38 100644 --- a/django/db/models/sql/compiler.py +++ b/django/db/models/sql/compiler.py @@ -135,6 +135,7 @@ class SQLCompiler: for expr in expressions: sql, params = self.compile(expr) + sql, params = expr.select_format(self, sql, params) params_hash = make_hashable(params) if (sql, params_hash) not in seen: result.append((sql, params)) -- cgit v1.3