[Django] #32187: The .select_related is not necessary in the .update documentation

18 views
Skip to first unread message

Django

unread,
Nov 11, 2020, 6:33:07 PM11/11/20
to django-...@googlegroups.com
#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.

Django

unread,
Nov 12, 2020, 3:09:48 AM11/12/20
to django-...@googlegroups.com
#32187: The .select_related is not necessary in the .update documentation
-------------------------------------+-------------------------------------
Reporter: Willem Van Onsem | Owner: nobody
Type: Bug | Status: new
Component: Documentation | Version: 3.1
Severity: Normal | Resolution:
Keywords: orm, query, | Triage Stage: Accepted
documentation |
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

* stage: Unreviewed => Accepted


Comment:

Yes, looks right.

--
Ticket URL: <https://code.djangoproject.com/ticket/32187#comment:1>

Django

unread,
Nov 12, 2020, 3:27:09 AM11/12/20
to django-...@googlegroups.com
#32187: The .select_related is not necessary in the .update documentation
-------------------------------------+-------------------------------------
Reporter: Willem Van Onsem | Owner: Hasan
| Ramezani
Type: Bug | Status: assigned

Component: Documentation | Version: 3.1
Severity: Normal | Resolution:
Keywords: orm, query, | Triage Stage: Accepted
documentation |
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Hasan Ramezani):

* owner: nobody => Hasan Ramezani
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/32187#comment:2>

Django

unread,
Nov 12, 2020, 4:06:37 AM11/12/20
to django-...@googlegroups.com
#32187: The .select_related is not necessary in the .update documentation
-------------------------------------+-------------------------------------
Reporter: Willem Van Onsem | Owner: Hasan
| Ramezani
Type: Bug | Status: closed
Component: Documentation | Version: 3.1
Severity: Normal | Resolution: fixed

Keywords: orm, query, | Triage Stage: Accepted
documentation |
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by GitHub <noreply@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"c448e614c60cc97c6194c62052363f4f501e0953" c448e61]:
{{{
#!CommitTicketReference repository=""
revision="c448e614c60cc97c6194c62052363f4f501e0953"
Fixed #32187 -- Removed unnecessary select_related in queries doc.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/32187#comment:3>

Django

unread,
Nov 12, 2020, 4:07:39 AM11/12/20
to django-...@googlegroups.com
#32187: The .select_related is not necessary in the .update documentation
-------------------------------------+-------------------------------------
Reporter: Willem Van Onsem | Owner: Hasan
| Ramezani
Type: Bug | Status: closed
Component: Documentation | Version: 3.1
Severity: Normal | Resolution: fixed
Keywords: orm, query, | Triage Stage: Accepted
documentation |
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Carlton Gibson <carlton.gibson@…>):

In [changeset:"eba8d6f5d73ed315e4b89b6cb92db57c3906bd5d" eba8d6f]:
{{{
#!CommitTicketReference repository=""
revision="eba8d6f5d73ed315e4b89b6cb92db57c3906bd5d"
[3.1.x] Fixed #32187 -- Removed unnecessary select_related in queries doc.

Backport of c448e614c60cc97c6194c62052363f4f501e0953 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/32187#comment:4>

Reply all
Reply to author
Forward
0 new messages