From 041551d716b69ee7c81199eee86a2d10a72e15ab Mon Sep 17 00:00:00 2001 From: Simon Charette Date: Sat, 5 Nov 2022 12:41:56 -0400 Subject: Fixed #31331 -- Switched MySQL to group by selected primary keys. MySQL 5.7.15 supports group by functional dependences so there is no need to special case group by main table primary key anymore and special case the ONLY_FULL_GROUP_BY sql mode. --- django/db/models/sql/compiler.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'django/db/models/sql') diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py index f3b2b3da41..b6574eab2e 100644 --- a/django/db/models/sql/compiler.py +++ b/django/db/models/sql/compiler.py @@ -235,7 +235,9 @@ class SQLCompiler: expressions = [ expr for expr in expressions - if expr in pks or getattr(expr, "alias", None) not in aliases + if expr in pks + or expr in having + or getattr(expr, "alias", None) not in aliases ] return expressions -- cgit v1.3