summaryrefslogtreecommitdiff
path: root/django/db/models/sql/query.py
Commit message (Collapse)AuthorAgeFilesLines
...
* Fixed #31377 -- Disabled grouping by aliases on ↵Hasan Ramezani2020-03-251-1/+14
| | | | | | | | QuerySet.values()/values_list() when they collide with field names. Regression in fb3f034f1c63160c0ff13c609acd01c18be12f80. Thanks Holovashchenko Vadym for the report.
* Refs #31136 -- Made QuerySet.values()/values_list() group only by selected ↵Mariusz Felisiak2020-01-151-7/+8
| | | | | annotation. Regression in 0f843fdd5b9b2f2307148465cd60f4e1b2befbb4.
* Fixed #31136 -- Disabled grouping by aliases on QuerySet.values()/values_list().Mariusz Felisiak2020-01-041-1/+3
| | | | | Regression in fb3f034f1c63160c0ff13c609acd01c18be12f80. Thanks Sigurd Ljødal for the report.
* Fixed #31109 -- Disabled grouping by aliases on QuerySet.exists().Simon Charette2019-12-231-2/+6
| | | | | | | | | | Clearing the SELECT clause in Query.has_results was orphaning GROUP BY references to it. Thanks Thierry Bastian for the report and Baptiste Mispelon for the bisect. Regression in fb3f034f1c63160c0ff13c609acd01c18be12f80.
* Fixed #31094 -- Included columns referenced by subqueries in GROUP BY on ↵Simon Charette2019-12-191-15/+27
| | | | | | | | | | aggregations. Thanks Johannes Hoppe for the report. Regression in fb3f034f1c63160c0ff13c609acd01c18be12f80. Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
* Used Signature API instead of deprecated inspect.getcallargs().Baptiste Mispelon2019-12-101-3/+2
| | | | | | | inspect.getcallargs() was deprecated in Python 3.5 and the Signature API (PEP 362) has better support for decorated functions (by default, it follows the __wrapped__ attribute set by functools.wraps for example).
* Made Query.check_filterable() use bool by default instead of str.Alex Aktsipetrov2019-12-061-1/+1
|
* Fixed #31060 -- Reallowed window expressions to be used in conditions ↵Alex Aktsipetrov2019-12-061-5/+9
| | | | | | | | outside of queryset filters. Regression in 4edad1ddf6203326e0be4bdb105beecb0fe454c4. Thanks utapyngo for the report.
* Refs #25367 -- Made Query.build_filter() raise TypeError on non-conditional ↵Simon Charette2019-11-211-1/+3
| | | | expressions.
* Fixed #30484 -- Added conditional expressions support to CheckConstraint.Simon Charette2019-11-211-15/+20
|
* Refs #25367 -- Moved conditional expression wrapping to the Exact lookup.Simon Charette2019-11-211-6/+1
|
* Refs #11964 -- Removed SimpleCol in favor of Query(alias_cols).Simon Charette2019-11-211-29/+25
| | | | | | This prevent having to pass simple_col through multiple function calls by defining whether or not references should be resolved with aliases at the Query level.
* Fixed #30971 -- Prevented Query.resolve_lookup_value() from coercing list ↵George Marshall2019-11-131-15/+4
| | | | | | values to tuples. Regression in 8a281aa7fe76a9da2284f943964a9413697cff1f.
* Fixed #30796 -- Prevented select_related() from mutating a queryset on chaining.Simon Charette2019-09-241-0/+5
| | | | Thanks Darren Maki for the report.
* Fixed #30739 -- Fixed exclusion of multi-valued lookup against outer rhs.Simon Charette2019-09-021-1/+3
| | | | | | 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.
* Fixed #25367 -- Allowed boolean expressions in QuerySet.filter() and exclude().Matthew Schinckel2019-08-291-0/+10
| | | | | | | | | | | 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>
* Fixed #30687 -- Fixed using of OuterRef() expressions in distance lookups.Andrew Brown2019-08-161-3/+9
|
* Fixed #30668 -- Made QuerySet.filter() raise NotSupportedError if any of ↵aaktsipetrov2019-08-021-5/+14
| | | | source expressions is not filterable.
* Added Query.is_sliced property.Mariusz Felisiak2019-07-251-5/+8
| | | | Previously, we used Query.can_filter() mainly to check if a query is sliced what was confusing.
* Fixed #28408 -- Added error message when updating with annotated expressions ↵can2019-06-281-2/+18
| | | | | | on joined fields. Co-Authored-By: Simon Charette <charette.s@gmail.com>
* Fixed #29834 -- Fixed column mismatch crash with ↵can2019-06-191-0/+4
| | | | QuerySet.values()/values_list() and order_by() on combined querysets.
* Fixed #30349 -- Fixed QuerySet.exclude() on FilteredRelation.Rob2019-05-071-3/+8
| | | | | | | | | | | | | 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.
* Fixed #30412 -- Fixed crash when adding check constraints with OR'ed ↵can2019-04-301-1/+1
| | | | condition on Oracle and SQLite.
* Refs #23758 -- Used RecursionError instead of RuntimeError to raise nested ↵Simon Charette2019-04-151-1/+1
| | | | | | subquery errors. RecursionError was introduced in Python 3.5 and subclasses RuntimeError.
* Refs #27149 -- Based recursive nested subquery detection on ↵Simon Charette2019-04-151-1/+6
| | | | | | | 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.
* Fixed #30246 -- Reused annotation aliases references in aggregation filters.Simon Charette2019-03-231-13/+17
| | | | Thanks Jan Baryła for the detailed report and the reduced test case.
* Refs #30188 -- Avoided GROUP BY when aggregating over non-aggregates.Simon Charette2019-03-231-4/+11
|
* Refs #30188 -- Prevented double annotation of subquery when aggregated over.Simon Charette2019-03-231-6/+10
| | | | Thanks Can Sarıgöl for the suggested trimming approach.
* Fixed #30188 -- Fixed a crash when aggregating over a subquery annotation.Simon Charette2019-03-231-2/+2
|
* Fixed #21703 -- Fixed a crash when excluding a related field with a F().Simon Charette2019-03-231-1/+6
|
* Removed obsolete Lookup hook to prepare rhs expressions.Simon Charette2019-03-211-3/+0
| | | | | After 3a505c70e7b228bf1212c067a8f38271ca86ce09, all _prepare() methods return self.
* Refs #27149, #29542 -- Simplified subquery parentheses wrapping logic.Simon Charette2019-03-211-1/+4
|
* Refs #27149 -- Moved subquery expression resolving to Query.Simon Charette2019-03-211-3/+25
| | | | | | | | | | 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.
* Refs #30158 -- Added alias argument to Expression.get_group_by_cols().Simon Charette2019-03-211-3/+17
|
* Fixed #30184 -- Removed ellipsis characters from shell output strings.Dan Davis2019-02-131-1/+1
| | | | Partially reverted 50b8493581fea3d7137dd8db33bac7008868d23a (refs #29654) to avoid a crash when the user shell doesn't support non-ASCII characters.
* Fixed #30159 -- Removed unneeded use of OrderedDict.Nick Pope2019-02-061-46/+27
| | | | Dicts preserve order since Python 3.6.
* Fixed #30044 -- Raised a FieldError on inherited field update attempts.Simon Charette2019-01-161-0/+2
|
* Fixed #29949 -- Refactored db introspection identifier converters.Mariusz Felisiak2018-11-211-1/+1
| | | | | | | | | 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.
* Refs #27795 -- Removed force_text() usage in db/models/sql/query.py.Jon Dufresne2018-10-081-2/+1
|
* Fixed #29804 -- Added 'did you mean' suggestions for unsupported lookup error.Abhinav Patil2018-10-011-2/+9
|
* Refs #28909 -- Simplifed code using unpacking generalizations.Sergey Fedoseev2018-09-281-12/+11
|
* Fixed #29727 -- Made nonexistent joins in F() raise FieldError.Alexander Holmbäck2018-09-081-1/+4
| | | | Regression in 2162f0983de0dfe2178531638ce7ea56f54dd4e7.
* Refs #29654 -- Replaced three dots with ellipsis character in output strings.Claude Paroz2018-08-221-1/+1
|
* Removed duplicate words in various comments.Mariusz Felisiak2018-07-181-2/+2
|
* Fixed #11964 -- Added support for database check constraints.Ian Foote2018-07-101-13/+33
|
* Fixed #29530 -- Fixed aliases ordering when chaining annotate() and filter().Mariusz Felisiak2018-07-021-2/+8
|
* Fixed #28574 -- Added QuerySet.explain().Tom2018-04-191-0/+12
|
* Fixed #25718 -- Made a JSONField lookup value of None match keys that have a ↵Dmitry Dygalo2018-04-041-3/+3
| | | | null value.
* Fixed #24747 -- Allowed transforms in QuerySet.order_by() and distinct(*fields).Matthew Wilkes2018-02-101-9/+50
|
* Refs #28814 -- Imported from collections.abc to fix Python 3.7 deprecation ↵Raymond Hettinger2018-02-051-1/+2
| | | | | warnings. https://bugs.python.org/issue25988