[3.0.x] Fixed #31109 -- Disabled grouping by aliases on QuerySet.exists().

Clearing the SELECT clause in Query.has_results was orphaning GROUP BY
references to it.

Thanks Thierry Bastian for the report and Baptiste Mispelon for the
bisect.

Regression in fb3f034f1c.

Backport of 720de4d044 from master
This commit is contained in:
Simon Charette 2019-12-21 23:22:49 -05:00 committed by Mariusz Felisiak
parent b1a309f6f0
commit 7b065c41e4
3 changed files with 19 additions and 2 deletions

View file

@ -11,3 +11,6 @@ Bugfixes
* Fixed a regression in Django 3.0 that didn't include columns referenced by a
``Subquery()`` in the ``GROUP BY`` clause (:ticket:`31094`).
* Fixed a regression in Django 3.0 where ``QuerySet.exists()`` crashed if a
queryset contained an aggregation over a ``Subquery()`` (:ticket:`31109`).