#32187: The .select_related is not necessary in the .update documentation
-------------------------------------+-------------------------------------
Reporter: KommuSoft | Owner: nobody
Type: Bug | Status: new
Component: | Version: 3.1
Documentation | Keywords: orm, query,
Severity: Normal | documentation
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-------------------------------------+-------------------------------------
This question on StackOverflow is questioning a part of the documentation
https://stackoverflow.com/q/64795627/67579
It asks what the use is of the .select_related in:
{{{
>>>
Entry.objects.select_related().filter(blog=b).update(headline='Everything
is the same')
}}}
To the best of my knowledge, there is no use of .select_reated in case of
a .update(..). Likely the ORM will ignore .select_related and
.prefetch_related calls, and if it does not, it can cause problems since
an UPDATE ... query with a JOIN ... clause results in problems about what
table to update and how.
It thus might be better to omit the .select_related() part here. Likely
this is due to copying from another part of the documentation.
--
Ticket URL: <https://code.djangoproject.com/ticket/32187>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/052.0e70283a5458c9f7df0c7abee714ead0%40djangoproject.com.