The optimization introduced in 7acef095d7 did not properly handle
deletion involving filters against aggregate annotations.
It initially was surfaced by a MariaDB test failure but misattributed
to an undocumented change in behavior that resulted in the systemic
generation of poorly performing database queries in 5b83bae031.
Thanks Anton Plotkin for the report.
Refs #23576.
The non-referenced fields can only be deferred if no deletion signals
receivers are connected for their respective model as connected as these
receivers might expect all fields of the deleted model to be present.
Thanks Ed Morley for the report.
Thanks to Trac alias ppetrid for the report and Tim for the review.
Conflicts:
django/db/models/deletion.py
tests/delete/tests.py
Forward port of 7c3ef19978 from stable/1.8.x