| Age | Commit message (Collapse) | Author |
|
FieldErrors.
Bug in cd1afd553f9c175ebccfc0f50e72b43b9604bd97.
Backport of 3afdc9e9b47d5bdd1bd653633b4cb2357478ade5 from main
|
|
referencing outer window expression.
Regression in f387d024fc75569d2a4a338bfda76cc2f328f627.
Co-authored-by: Jannis Vajen <jvajen@gmail.com>
Backport of c67ea79aa981ae82595d89f8018a41fcd842e7c9 from main
|
|
OrderBy.
Regression in 278881e37619278789942513916acafaa88d26f3 caused by a lack
of expression copying when an OrderBy expression is explicitly provided.
Thanks Jannis Vajen for the report and regression test.
Backport of b15f162f252610e3b510ade465549769ab4356cf from main
|
|
Used the same approach as for #34176 by using selected expressions
position to prevent ambiguous aliases in collisions.
Thanks henribru for the report.
Regression in 04518e310d4552ff7595a34f5a7f93487d78a406.
Backport of 278881e37619278789942513916acafaa88d26f3 from main
|
|
FilteredRelation.
Backport of d3c93cdc597e0efc2815111c04dd5a427432ed37 from main
|
|
Regression in 3d734c09ff0138441dfe0a59010435871d17950f.
Thanks Raphaël Stefanini for the report.
Backport of cc8aa6bf9c127a493e6dd005012b9e6397b3f319 from main
|
|
Regression in b7b28c7c189615543218e81319473888bc46d831.
Refs #31377.
Thanks Shai Berger for the report and reviews.
test_aggregation_subquery_annotation_values_collision() has been
updated as queries that are explicitly grouped by a subquery should
always be grouped by it and not its outer columns even if its alias
collides with referenced table columns. This was not possible to
accomplish at the time 10866a10 landed because we didn't have compiler
level handling of colliding aliases.
|
|
|
|
FilteredRelations to the OneToOneField.
|
|
SQLCompiler.get_related_selections() to avoid redefinition.
|
|
to JSONField & co.
JSON should be provided as literal Python objects an not in their
encoded string literal forms.
|
|
By avoiding to annotate aggregations meant to be possibly pushed to an
outer query until their references are resolved it is possible to
aggregate over a query with the same alias.
Even if #34176 is a convoluted case to support, this refactor seems
worth it given the reduction in complexity it brings with regards to
annotation removal when performing a subquery pushdown.
|
|
unique_fields/update_fields.
Bug in 0f6946495a8ec955b471ca1baaf408ceb53d4796.
Thanks Joshua Brooks for the report.
|
|
Regression in c58a8acd413ccc992dd30afd98ed900897e1f719.
Thanks to Shai Berger for the report and tests.
Co-Authored-By: David Sanders <shang.xiao.sanders@gmail.com>
|
|
This ensures proper alias quoting.
|
|
The latter offers a more generic interface that doesn't require
specialized expression types handling.
|
|
|
|
Just like when using .annotate(), the .alias() method will generate the
necessary JOINs to resolve the alias even if not selected.
Since these JOINs could be multi-valued non-selected aggregates must be
considered to require subquery wrapping as a GROUP BY is required to
combine duplicated tuples from the base table.
Regression in 59bea9efd2768102fc9d3aedda469502c218e9b7.
|
|
|
|
Also avoid an unnecessary pushdown when aggregating over a query that doesn't
have aggregate annotations.
|
|
Adjusting WhereNode.as_sql() to raise an exception when encoutering a
full match just like with empty matches ensures that all case are
explicitly handled.
|
|
No core backend require the feature anymore as it was only added to
support a MySQL'ism that has been deprecated since then.
|
|
MySQL 5.7.15 supports group by functional dependences so there is no
need to special case group by main table primary key anymore and
special case the ONLY_FULL_GROUP_BY sql mode.
|
|
Identified using the following command:
$ git grep -I '\(\<[_a-zA-Z0-9]\+\>\) *= *\1 *[-+/*^%&|<>@]'
|
|
queryset.
The bug existed since sliced query union was added but was elevated to
query union slices by moving the .exists() optimization to the compiler
in 3d734c09ff0138441dfe0a59010435871d17950f.
Thanks Stefan Hammer for the report.
|
|
|
|
This stops ordering by nested selected references. It's not supported on
PostgreSQL and not required to support psycopg3.
Regression in 04518e310d4552ff7595a34f5a7f93487d78a406.
Thanks Matt Westcott for the report.
|
|
Recent refactors allowed GROUP BY aliasing allowed for aliasing to be
entirely handled by the sql.Query.set_group_by and compiler layers.
|
|
This ensures implicit grouping from aggregate function annotations
groups by uncollapsed selected aliases if supported.
The feature is disabled on Oracle because it doesn't support it.
|
|
This required moving the combined queries slicing logic to the compiler
in order to allow Query.exists() to be called at expression resolving
time.
It allowed for Query.exists() to be called at Exists() initialization
time and thus ensured that get_group_by_cols() was operating on the
terminal representation of the query that only has a single column
selected.
|
|
This ensures explicit grouping from using values() before annotating an
aggregate function groups by selected aliases if supported.
The GROUP BY feature is disabled on Oracle because it doesn't support it.
|
|
MySQL.
Columns of the left outer most select statement in a combined query
can be referenced by alias just like by index.
This removes combined query ordering by column index and avoids an
unnecessary usage of RawSQL which causes issues for backends that
specialize the treatment of null ordering.
|
|
The SQLCompiler._order_by_pairs() generator method yields instances of
OrderBy and not Expression.
|
|
for models with Meta.ordering.
This makes QuerySet.order_by() no longer ignore trailing transforms for
models with Meta.ordering. As a consequence, FieldError is raised in
such cases for non-existent fields.
Thanks to Klaas van Schelven for the report and Mariusz Felisiak for the
review and advice.
|
|
annotations.
This reverts b64db05b9cedd96905d637a2d824cbbf428e40e7.
It was reasonable to assume it was unnecessary code as there were
no failing tests upon its removal. This commit adds the necessary
regression tests for the failing condition identified in #34024
alongside the original tests added in the PR for which
WhereNode.is_summary was introduced.
|
|
|
|
While most backends will propagate derived table ordering as long as
the outer query doesn't perform additional processing the SQL specs
doesn't explicitly state the ordering must be maintained.
|
|
alias().
This fixes clearing selected fields.
|
|
containing Exists.
A more in-depth solution is likely to make sure that we always GROUP BY
selected annotations or revisit how we use Query.exists() in the Exists
expression but that requires extra work that isn't suitable for a
backport.
Regression in e5a92d400acb4ca6a8e1375d1ab8121f2c7220be.
Thanks Fernando Flores Villaça for the report.
|
|
This ensures field deferral works properly when a model is involved
more than once in the same query with a distinct deferral mask.
|
|
Adds support for joint predicates against window annotations through
subquery wrapping while maintaining errors for disjointed filter
attempts.
The "qualify" wording was used to refer to predicates against window
annotations as it's the name of a specialized Snowflake extension to
SQL that is to window functions what HAVING is to aggregates.
While not complete the implementation should cover most of the common
use cases for filtering against window functions without requiring
the complex subquery pushdown and predicate re-aliasing machinery to
deal with disjointed predicates against columns, aggregates, and window
functions.
A complete disjointed filtering implementation should likely be
deferred until proper QUALIFY support lands or the ORM gains a proper
subquery pushdown interface.
|
|
This extends query composability possibilities when dealing with
subqueries which is necessary to implement window function filtering.
|
|
This allows the copy.copy() usage in the Q._combine() method to finish
sooner, instead of having to fallback to using the __reduce_ex__(4)
method.
Thia also avoids having to fall into copy.copy() at in Q._combine(),
when combining a Q() with another Q().
Co-authored-by: Keryn Knight <keryn@kerynknight.com>
|
|
We can use copy() in Node.add() instead of create() as we don't need the
children to be cloned via [:] subscript in __init__().
|
|
Node._new_instance() was added in
6dd2b5468fa275d53aa60fdcaff8c28bdc5e9c25 to work around Q.__init__()
having an incompatible signature with Node.__init__().
It was intended as a hook that could be overridden if subclasses needed
to change the behaviour of instantiation of their specialised form of
Node. In practice this doesn't ever seem to have been used for this
purpose and there are very few calls to Node._new_instance() with other
code, e.g. Node.__deepcopy__() calling Node and overriding __class__ as
required.
Rename this to Node.create() to make it a more "official" piece of
private API that we can use to simplify a lot of other areas internally.
The docstring and nearby comment have been reworded to read more
clearly.
|
|
Node.subtree_parents was removed in
d3f00bd5706b35961390d3814dd7e322ead3a9a3. That commit also added
Q.clone() which was identical to WhereNode.clone(), but lacked the
docstring. Q.clone() was later removed in
b454e2cbc95eb26fa0c32b54c53ae24fc40e8c02.
|
|
|
|
models.
|
|
used in subquery on Oracle.
|
|
on PostgreSQL and MySQL.
Thanks Shai Berger for the report.
Regression in 30a01441347d5a2146af2944b29778fa0834d4be.
|