summaryrefslogtreecommitdiff
path: root/django/db/models/sql/query.py
AgeCommit message (Collapse)Author
2019-11-13[3.0.x] Fixed #30971 -- Prevented Query.resolve_lookup_value() from coercing ↵George Marshall
list values to tuples. Regression in 8a281aa7fe76a9da2284f943964a9413697cff1f. Backport of 8be79984dce7d819879a6e594ca69c5f95a08378 from master
2019-09-24[3.0.x] Fixed #30796 -- Prevented select_related() from mutating a queryset ↵Simon Charette
on chaining. Thanks Darren Maki for the report. Backport of 37f8f293775d0b672da8ae369d9a4e17f1db7851 from master
2019-09-02Fixed #30739 -- Fixed exclusion of multi-valued lookup against outer rhs.Simon Charette
OuterRef right hand sides have to be nested, just like F rhs have to, during the subquery pushdown split_exclude performs to ensure they are resolved against the outer query aliases.
2019-08-29Fixed #25367 -- Allowed boolean expressions in QuerySet.filter() and exclude().Matthew Schinckel
This allows using expressions that have an output_field that is a BooleanField to be used directly in a queryset filters, or in the When() clauses of a Case() expression. Thanks Josh Smeaton, Tim Graham, Simon Charette, Mariusz Felisiak, and Adam Johnson for reviews. Co-Authored-By: NyanKiyoshi <hello@vanille.bid>
2019-08-16Fixed #30687 -- Fixed using of OuterRef() expressions in distance lookups.Andrew Brown
2019-08-02Fixed #30668 -- Made QuerySet.filter() raise NotSupportedError if any of ↵aaktsipetrov
source expressions is not filterable.
2019-07-25Added Query.is_sliced property.Mariusz Felisiak
Previously, we used Query.can_filter() mainly to check if a query is sliced what was confusing.
2019-06-28Fixed #28408 -- Added error message when updating with annotated expressions ↵can
on joined fields. Co-Authored-By: Simon Charette <charette.s@gmail.com>
2019-06-19Fixed #29834 -- Fixed column mismatch crash with ↵can
QuerySet.values()/values_list() and order_by() on combined querysets.
2019-05-07Fixed #30349 -- Fixed QuerySet.exclude() on FilteredRelation.Rob
Using annotated FilteredRelations raised a FieldError when coupled with exclude(). This is due to not passing filtered relation fields to the subquery created in split_exclude(). We fixed this issue by passing the filtered relation data to the newly created subquery. Secondly, in the case where an INNER JOIN is used in the excluded subquery, the ORM would trim the filtered relation INNER JOIN in attempt to simplify the query. This will also remove the ON clause filters generated by the FilteredRelation. We added logic to not trim the INNER JOIN if it is from FilteredRelation.
2019-04-30Fixed #30412 -- Fixed crash when adding check constraints with OR'ed ↵can
condition on Oracle and SQLite.
2019-04-15Refs #23758 -- Used RecursionError instead of RuntimeError to raise nested ↵Simon Charette
subquery errors. RecursionError was introduced in Python 3.5 and subclasses RuntimeError.
2019-04-15Refs #27149 -- Based recursive nested subquery detection on ↵Simon Charette
sys.getrecursionlimit(). This makes sure the test_avoid_infinite_loop_on_too_many_subqueries test doesn't fail on systems with a non-default recursion limit.
2019-03-23Fixed #30246 -- Reused annotation aliases references in aggregation filters.Simon Charette
Thanks Jan Baryła for the detailed report and the reduced test case.
2019-03-23Refs #30188 -- Avoided GROUP BY when aggregating over non-aggregates.Simon Charette
2019-03-23Refs #30188 -- Prevented double annotation of subquery when aggregated over.Simon Charette
Thanks Can Sarıgöl for the suggested trimming approach.
2019-03-23Fixed #30188 -- Fixed a crash when aggregating over a subquery annotation.Simon Charette
2019-03-23Fixed #21703 -- Fixed a crash when excluding a related field with a F().Simon Charette
2019-03-21Removed obsolete Lookup hook to prepare rhs expressions.Simon Charette
After 3a505c70e7b228bf1212c067a8f38271ca86ce09, all _prepare() methods return self.
2019-03-21Refs #27149, #29542 -- Simplified subquery parentheses wrapping logic.Simon Charette
2019-03-21Refs #27149 -- Moved subquery expression resolving to Query.Simon Charette
This makes Subquery a thin wrapper over Query and makes sure it respects the Expression source expression API by accepting the same number of expressions as it returns. Refs #30188. It also makes OuterRef usable in Query without Subquery wrapping. This should allow Query's internals to more easily perform subquery push downs during split_exclude(). Refs #21703.
2019-03-21Refs #30158 -- Added alias argument to Expression.get_group_by_cols().Simon Charette
2019-02-13Fixed #30184 -- Removed ellipsis characters from shell output strings.Dan Davis
Partially reverted 50b8493581fea3d7137dd8db33bac7008868d23a (refs #29654) to avoid a crash when the user shell doesn't support non-ASCII characters.
2019-02-06Fixed #30159 -- Removed unneeded use of OrderedDict.Nick Pope
Dicts preserve order since Python 3.6.
2019-01-16Fixed #30044 -- Raised a FieldError on inherited field update attempts.Simon Charette
2018-11-21Fixed #29949 -- Refactored db introspection identifier converters.Mariusz Felisiak
Removed DatabaseIntrospection.table_name_converter()/column_name_converter() and use instead DatabaseIntrospection.identifier_converter(). Removed DatabaseFeatures.uppercases_column_names. Thanks Tim Graham for the initial patch and review and Simon Charette for the review.
2018-10-08Refs #27795 -- Removed force_text() usage in db/models/sql/query.py.Jon Dufresne
2018-10-01Fixed #29804 -- Added 'did you mean' suggestions for unsupported lookup error.Abhinav Patil
2018-09-28Refs #28909 -- Simplifed code using unpacking generalizations.Sergey Fedoseev
2018-09-08Fixed #29727 -- Made nonexistent joins in F() raise FieldError.Alexander Holmbäck
Regression in 2162f0983de0dfe2178531638ce7ea56f54dd4e7.
2018-08-22Refs #29654 -- Replaced three dots with ellipsis character in output strings.Claude Paroz
2018-07-18Removed duplicate words in various comments.Mariusz Felisiak
2018-07-10Fixed #11964 -- Added support for database check constraints.Ian Foote
2018-07-02Fixed #29530 -- Fixed aliases ordering when chaining annotate() and filter().Mariusz Felisiak
2018-04-19Fixed #28574 -- Added QuerySet.explain().Tom
2018-04-04Fixed #25718 -- Made a JSONField lookup value of None match keys that have a ↵Dmitry Dygalo
null value.
2018-02-10Fixed #24747 -- Allowed transforms in QuerySet.order_by() and distinct(*fields).Matthew Wilkes
2018-02-05Refs #28814 -- Imported from collections.abc to fix Python 3.7 deprecation ↵Raymond Hettinger
warnings. https://bugs.python.org/issue25988
2018-01-12Removed Query.split_exclude()'s unused prefix argument.Mariusz Felisiak
Unused since b4492a8ca4a7ae4daa3a6b03c3d7a845fad74931.
2018-01-12Fixed #28996 -- Simplified some boolean constructs and removed trivial ↵Дилян Палаузов
continue statements.
2018-01-03Fixed #28982 -- Simplified code with and/or.Дилян Палаузов
2018-01-03Fixed #28811 -- Fixed crash when combining regular and group by annotations.Robin Ramael
2017-12-12Refs #27985 -- Reallowed using __exact=None as an alias for __isnull=True if ↵Sergey Fedoseev
a custom lookup class with lookup_name != None is registered as the exact lookup. Regression in 58da81a5a372a69f0bac801c412b57f3cce5f188 and prerequisite for refs #28896.
2017-12-06Fixed #28893 -- Removed unnecessary dict.items() calls.Tim Graham
2017-12-04Fixed #28860 -- Removed unnecessary len() calls.Дилян Палаузов
2017-11-14Fixed #28795 -- Removed 'not in' checks and used dict.setdefault().Дилян Палаузов
2017-11-07Fixed #28769 -- Replaced 'x if x else y' with 'x or y'.Дилян Палаузов
2017-10-16Fixed #28497 -- Restored the ability to use sliced QuerySets with __exact.Tim Graham
Regression in ec50937bcbe160e658ef881021402e156beb0eaf. Thanks Simon Charette for review.
2017-09-22Fixed #27332 -- Added FilteredRelation API for conditional join (ON clause) ↵Nicolas Delaby
support. Thanks Anssi Kääriäinen for contributing to the patch.
2017-09-20Removed unused list in Query.resolve_lookup_value().Nicolas Delaby
Unneeded since its introduction in 4f138fe5a496a81115c4fba6615a517fc62c3b17.