This results in the generated query being unstable between different runs
of the python interpreter due to hash seed randomisation.
--
Ticket URL: <https://code.djangoproject.com/ticket/29503>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* has_patch: 0 => 1
Comment:
[https://github.com/django/django/pull/10060 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/29503#comment:1>
Comment (by Tim Graham):
What practical problem did you encounter? I'm surprised that the order of
items in an `IN` clause would matter much.
--
Ticket URL: <https://code.djangoproject.com/ticket/29503#comment:2>
Comment (by Nick Pope):
Replying to [comment:2 Tim Graham]:
> What practical problem did you encounter? I'm surprised that the order
of items in an `IN` clause would matter much.
Heh. I get the feeling that I'm going to get shot down here (and I know
and understand the reasons why).
I've inherited some code that currently and for the foreseeable future
depends on the output of the query generated by `Query.sql_with_params()`.
It executes it via `pandas.DataFrame.read_sql_query()` and also uses this
to generate a cache key. Because the parameter ordering is unstable, this
affects the key generation.
Regardless of the horrors of this, the issue looks like a regression to me
- the previous behaviour changed unexpectedly. I can understand if you'd
like to only apply this to master, however.
--
Ticket URL: <https://code.djangoproject.com/ticket/29503#comment:3>
* cc: Ian Foote (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/29503#comment:4>
* cc: Carlton Gibson (added)
* stage: Unreviewed => Ready for checkin
Comment:
I'd be happy with the use of `OrderedSet` here. Semantically `in` uses a
set but we (always/mostly?) pass it a list, which is ordered, and it's
reasonable enough to maintain that. (Beyond Nick's usage, it could be
handy somewhere.)
Is this a regression? Was it always part of the contract? Not sure. Pass.
:)
--
Ticket URL: <https://code.djangoproject.com/ticket/29503#comment:5>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"b0fbfae09334554124e1dccb7559d10f36e2f84c" b0fbfae0]:
{{{
#!CommitTicketReference repository=""
revision="b0fbfae09334554124e1dccb7559d10f36e2f84c"
Fixed #29503 -- Made __in lookup keep order of values in query.
Regression in 86eccdc8b67728d84440a46e5bf62c78f2eddf6d.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29503#comment:6>
Comment (by Tim Graham <timograham@…>):
In [changeset:"16e691d568a06873445171025ba44b5f00920e7e" 16e691d]:
{{{
#!CommitTicketReference repository=""
revision="16e691d568a06873445171025ba44b5f00920e7e"
[2.1.x] Fixed #29503 -- Made __in lookup keep order of values in query.
Regression in 86eccdc8b67728d84440a46e5bf62c78f2eddf6d.
Backport of b0fbfae09334554124e1dccb7559d10f36e2f84c from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29503#comment:7>