| Age | Commit message (Collapse) | Author |
|
Thanks Tim Graham for review.
|
|
Callable arguments were an untested and undocumented feature.
|
|
Thanks Anubhav Joshi for the documentation.
|
|
|
|
|
|
|
|
|
|
Refs #21169
|
|
definitions.
Refs #21432.
|
|
Thanks Enrique Martínez for the report and @bmispelon for the tests.
|
|
|
|
|
|
Instead always create new joins as OUTER.
|
|
This commit introduced a new class JoinPromoter that can be used to
abstract away join promotion problems for complex filter conditions.
Query._add_q() and Query.combine() now use the new class.
Also, added a lot of comments about why join promotion is done the way
it is.
Thanks to Tim Graham for original report and testing the changes, and
for Loic Bistuer for review.
|
|
Refs #21302
|
|
|
|
|
|
|
|
The regression was caused by ecaba3602837d1e02fe1e961f7d3bf9086453259
and affected OR connected filters.
|
|
The typo could have consequences in exceptional cases, but I didn't
figure out a way to actually produce such a case, so not tests.
Report & patch by Michael Manfre.
|
|
|
|
select_related('foo').select_related('bar') is now equivalent to
select_related('foo', 'bar').
Also reworded docs to recommend select_related(*fields) over select_related()
|
|
|
|
There were multiple cases where join promotion was a bit too aggressive.
This resulted in using outer joins where not necessary.
Refs #21150.
|
|
In queries using .defer() together with .select_related() the values
and fields arguments didn't align properly for resolve_columns().
|
|
A .annotate().select_related() query resulted in misaligned rows vs
columns for compiler.resolve_columns() method.
Report & patch by Michael Manfre.
|
|
The commit for #18333 missed quote_cache default value for *.
Refs #18333.
|
|
|
|
Changed 'there are no filtering' to 'there is no filtering'.
|
|
We have always been at war with trailing backslashes.
|
|
Thanks PaulM for the suggestion and Luke Granger-Brown and
Wiktor Kołodziej for the initial patch.
|
|
The use of OrderedDict (even an empty one) was surprisingly slow. By
initializing OrderedDict only when needed it is possible to save
non-trivial amount of computing time (Model.save() is around 30% faster
for example).
This commit targetted sql.Query only, there are likely other places
which could use similar optimizations.
|
|
|
|
|
|
|
|
Thanks jeroen.pulles at redslider.net for the suggestion and
helper script.
|
|
In cases where the same connection (from model A to model B along the
same field) was needed multiple times in a select_related query, the
join setup code mistakenly reused an existing join.
|
|
If LEFT JOINs are required for correct results, then trimming the join
can lead to incorrect results. Consider case:
TBL A: ID | TBL B: ID A_ID
1 1 1
2
Now A.order_by('b__a') did use a join to B, and B's a_id column. This
was seen to contain the same value as A's id, and so the join was
trimmed. But this wasn't correct as the join is LEFT JOIN, and for row
A.id = 2 the B.a_id column is NULL.
|
|
There were clauses that weren't needed in the subqueries. These were
ORDER BY, SELECT FOR UPDATE and related selections.
|
|
|
|
Also made some cleanup to build_filter() code by introducing submethods
solve_lookup_type() and prepare_lookup_value().
|
|
The bug was already fixed by 01b9c3d5193fe61b82ae8b26242a13fdec22f211,
so only tests added.
At the same time promote_joins()'s uncoditional flag is gone, it isn't
needed for anything any more.
|
|
Thanks Loic Bistuer for the review.
|
|
|
|
The change also removed allow_explicit_fk from sql/query.py.
|
|
All Promise objects were passed to force_text() deep in ORM query code.
Not only does this make it difficult or impossible for developers to
prevent or alter this behaviour, but it is also wrong for non-text
fields.
This commit changes `Field.get_prep_value()` from a no-op to one that
resolved Promise objects. All subclasses now call super() method first
to ensure that they have a real value to work with.
|
|
Should be unneeded with Python 2.7 and up.
Added some unicode_literals along the way.
|
|
In the combination of .values().aggregate() the aggregate_select_mask
didn't include the aggregates added. This resulted in bogus query.
Thanks to Trac alias debanshuk for report.
|
|
|
|
Thanks jonash.
|