#28199: `Subquery` in __in filter generating invalid SQL
-------------------------------------+-------------------------------------
Reporter: Murray | Owner: nobody
Christopherson |
Type: Bug | Status: new
Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: subquery | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Simon Charette):
* component: Uncategorized => Database layer (models, ORM)
* severity: Normal => Release blocker
* stage: Unreviewed => Accepted
Comment:
Using a query directly for a `__in` lookup has always been working and
[https://github.com/django/django/commit/236ebe94bfe24d394d5b49f4405da445550e8aa6#commitcomment-20478749
I think we should adjust the documentation] to avoid encouraging usage of
`Subquery` if `OuterRef` is not required.
An even better solution would be to make
`__in=queryset.filter(field=OuterRef('other_field'))` work out of the box
and either deprecate `Subquery` or make it a dummy wrapper.
In the mean time this issue is probably related to `Subquery.output_field`
causing an unnecessary `Cast`.
--
Ticket URL: <https://code.djangoproject.com/ticket/28199#comment:1>
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/067.88298762cb3a3f5d5f6141fe703450b5%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.