#34321: Unexpected query result after call QuerySet.only() to ForeignKey() with
'self' reference
-------------------------------------+-------------------------------------
Reporter: Mahardhika Praja | Owner: nobody
Type: Bug | Status: closed
Component: Database layer | Version: 3.2
(models, ORM) |
Severity: Normal | Resolution: invalid
Keywords: queryset | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):
* status: new => closed
* resolution: => invalid
Comment:
`only()` works as
[https://docs.djangoproject.com/en/stable/ref/models/querysets/#only
documented] and expected, i.e. it replaces the set of fields to load
immediately, so in your case all columns `"mymodel"."f1"`,
`"mymodel"."f2"`, and `"mymodel"."f3"` from `MyModel` should be omitted in
the `SELECT` clause. `f1` appears because `MyModel` is involved more than
once, it was fixed in b3db6c8dcb5145f7d45eff517bcd96460475c879 (see
#21204).
--
Ticket URL: <https://code.djangoproject.com/ticket/34321#comment:2>
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/010701863078d4da-fd1bfe68-8c5b-41a1-8905-057adb7045f8-000000%40eu-central-1.amazonses.com.