Currently all subqueries get their ordering cleared if they aren't
fulfilling some conditions like being sliced and using distinct fields.
This would need to be refactored to enable array subqueries since the
ordering matters due to the subquery producing an array.
There've been a couple of tickets related to this:
https://code.djangoproject.com/ticket/31687
https://code.djangoproject.com/ticket/32658
[https://code.djangoproject.com/ticket/32658#comment:4 Simons suggestion]
to move the clearing of ordering from `Query.resolve_expression` to
`In(Lookup).process_rhs` seems like a good idea to me.
I also think that adding support for array subqueries would help in
resolving this ticket: https://code.djangoproject.com/ticket/26056
--
Ticket URL: <https://code.djangoproject.com/ticket/32776>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* stage: Unreviewed => Accepted
Comment:
Another edge case that came to mind is that we also likely want to keep
clearing ordering when doing existence checks so it should only be cleared
when using
1. `filter(field__in=query)`
2. `Exists`
3. `Queryset.exists()`
--
Ticket URL: <https://code.djangoproject.com/ticket/32776#comment:1>
* has_patch: 0 => 1
Comment:
PR: https://github.com/django/django/pull/14575
--
Ticket URL: <https://code.djangoproject.com/ticket/32776#comment:2>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/32776#comment:3>
* needs_better_patch: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/32776#comment:4>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/32776#comment:5>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"a06b977a91f043c509df781670fb4cf35cb437b7" a06b977a]:
{{{
#!CommitTicketReference repository=""
revision="a06b977a91f043c509df781670fb4cf35cb437b7"
Fixed #32776 -- Added support for Array subqueries on PostgreSQL.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/32776#comment:6>