django1/django
Simon Charette 0701bb8e1f Fixed #33928 -- Avoided unnecessary queries when cascade updating.
Models that use SET, SET_NULL, and SET_DEFAULT as on_delete handler
don't have to fetch objects for the sole purpose of passing them back to
a follow up UPDATE query filtered by the retrieved objects primary key.

This was achieved by flagging SET handlers as _lazy_ and having the
collector logic defer object collections until the last minute. This
should ensure that the rare cases where custom on_delete handlers are
defined remain uncalled when when dealing with an empty collection of
instances.

This reduces the number queries required to apply SET handlers from
2 to 1 where the remaining UPDATE use the same predicate as the non
removed SELECT query.

In a lot of ways this is similar to the fast-delete optimization that
was added in #18676 but for updates this time. The conditions only
happen to be simpler in this case because SET handlers are always
terminal. They never cascade to more deletes that can be combined.

Thanks Renan GEHAN for the report.
2022-08-27 14:25:55 +02:00
..
apps Rewrote some references to "master". 2022-03-08 14:50:06 +01:00
conf Updated translations from Transifex. 2022-08-03 08:04:34 +02:00
contrib Fixed #33927 -- Fixed crash when displaying ArrayField with choices in admin. 2022-08-23 15:51:42 +02:00
core Fixed #33949 -- Fixed fixture dirs duplicates with Path instances. 2022-08-23 13:24:18 +02:00
db Fixed #33928 -- Avoided unnecessary queries when cascade updating. 2022-08-27 14:25:55 +02:00
dispatch Refs #33476 -- Reformatted code with Black. 2022-02-07 20:37:05 +01:00
forms Fixed #33830 -- Fixed VariableDoesNotExist when rendering ClearableFileInput. 2022-08-25 07:52:36 +02:00
http Fixed CVE-2022-36359 -- Escaped filename in Content-Disposition header. 2022-08-03 08:46:31 +02:00
middleware Fixed #33700 -- Skipped extra resolution for successful requests not ending with /. 2022-06-02 15:15:04 +02:00
template Fixed #33864 -- Deprecated length_is template filter. 2022-07-23 12:36:21 +02:00
templatetags Fixed #33631 -- Marked {% blocktranslate asvar %} result as HTML safe. 2022-07-14 11:09:19 +02:00
test Fixed #33891 -- Fixed test command crash when running in parallel using spawn. 2022-08-04 09:16:38 +02:00
urls Fixed #32565 -- Moved internal URLResolver view-strings mapping to admindocs. 2022-05-17 10:50:09 +02:00
utils Refs #30213 -- Removed post-startup check for Watchman availability. 2022-08-11 11:02:03 +02:00
views Fixed #33878 -- Switched to system fonts in CSS. 2022-08-17 10:19:00 +02:00
__init__.py Bumped version; main is now 4.2 pre-alpha. 2022-05-17 14:22:06 +02:00
__main__.py Fixed #24857 -- Added "python -m django" entry point. 2015-09-07 19:54:32 -04:00
shortcuts.py Refs #33476 -- Reformatted code with Black. 2022-02-07 20:37:05 +01:00