summaryrefslogtreecommitdiff
path: root/tests/queries
AgeCommit message (Collapse)Author
2021-05-13[3.2.x] Fixed #32717 -- Fixed filtering of querysets combined with the | ↵Simon Charette
operator. Address a long standing bug in a Where.add optimization to discard equal nodes that was surfaced by implementing equality for Lookup instances in bbf141bcdc31f1324048af9233583a523ac54c94. Thanks Shaheed Haque for the report. Backport of b81c7562fc33f50166d5120138d6398dc42b13c3 from main
2021-04-28[3.2.x] Fixed #32632, Fixed #32657 -- Removed flawed support for Subquery ↵Simon Charette
deconstruction. Subquery deconstruction support required implementing complex and expensive equality rules for sql.Query objects for little benefit as the latter cannot themselves be made deconstructible to their reference to model classes. Making Expression @deconstructible and not BaseExpression allows interested parties to conform to the "expression" API even if they are not deconstructible as it's only a requirement for expressions allowed in Model fields and meta options (e.g. constraints, indexes). Thanks Phillip Cutter for the report. This also fixes a performance regression in bbf141bcdc31f1324048af9233583a523ac54c94. Backport of c8b659430556dca0b2fe27cf2ea0f8290dbafecd from main
2021-04-22[3.2.x] Used assertCountEqual() in ExcludeTests.test_exclude_subquery().Mariusz Felisiak
Backport of c3278bb71fe03132704525abcdf29bb4f1b3f143 from main
2021-04-21[3.2.x] Fixed #32650 -- Fixed handling subquery aliasing on queryset ↵Simon Charette
combination. This issue started manifesting itself when nesting a combined subquery relying on exclude() since 8593e162c9cb63a6c0b06daf045bc1c21eb4d7c1 but sql.Query.combine never properly handled subqueries outer refs in the first place, see QuerySetBitwiseOperationTests.test_subquery_aliases() (refs #27149). Thanks Raffaele Salmaso for the report. Backport of 6d0cbe42c3d382e5393d4af48185c546bb0ada1f from main
2021-04-14[3.2.x] Fixed #32548 -- Fixed crash when combining Q() objects with boolean ↵Jonathan Richards
expressions. Backport of 00b0786de533dbb3f6208d8d5eaddbf765b4e5b8 from main. Regression in 466920f6d726eee90d5566e0a9948e92b33a122e.
2021-04-13[3.2.x] Fixed #32627 -- Fixed QuerySet.values()/values_list() crash on ↵Iuri de Silvio
combined querysets ordered by unannotated columns. Backport of 9760e262f85ae57df39abe2799eff48a82b14474 from main
2021-02-18[3.2.x] Fixed #32450 -- Fixed crash when ANDing/ORing an empty Q() with not ↵starryrbs
pickleable Q(). Regression in bb0b6e526340e638522e093765e534df4e4393d2. Backport of 466920f6d726eee90d5566e0a9948e92b33a122e from master
2020-12-10Fixed #32178 -- Allowed database backends to skip tests and mark expected ↵Hasan Ramezani
failures. Co-authored-by: Tim Graham <timograham@gmail.com>
2020-11-16Fixed #31507 -- Added QuerySet.exists() optimizations to compound queries.David-Wobrock
2020-11-16Refs #27718 -- Doc'd and tested QuerySet.exists() for combined querysets.David-Wobrock
Supported since 84c1826ded17b2d74f66717fb745fc36e37949fd.
2020-11-14Fixed #31496 -- Fixed QuerySet.values()/values_list() crash on combined ↵David-Wobrock
querysets ordered by annotations.
2020-11-06Fixed #31235 -- Made assertQuerysetEqual() compare querysets directly.Hasan Ramezani
This also replaces assertQuerysetEqual() to assertSequenceEqual()/assertCountEqual() where appropriate. Co-authored-by: Peter Inglesby <peter.inglesby@gmail.com> Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2020-10-28Fixed #32143 -- Used EXISTS to exclude multi-valued relationships.Simon Charette
As mentioned in the pre-existing split_exclude() docstring EXISTS is easier to optimize for query planers and circumvents the IN (NULL) handling issue.
2020-10-28Refs #27149 -- Fixed sql.Query identity.Simon Charette
By making Query subclass BaseExpression in 35431298226165986ad07e91f9d3aca721ff38ec the former defined it's identity based off _construct_args which is not appropriate.
2020-10-27Fixed some queries tests when primary key values are large.Tim Graham
On CockroachDB, primary key values stored in these fields are larger than they accept. Fixes: queries.test_bulk_update.BulkUpdateNoteTests.test_multiple_fields, queries.test_bulk_update.BulkUpdateNoteTests.test_inherited_fields, and queries.tests.RelatedLookupTypeTests.test_values_queryset_lookup.
2020-10-27Removed an obsolete query test that assumes serial pks.Tim Graham
The code from the original fix (922aba3def68e57c405a0e50d353a790af85b00a) was removed in 419de7b00daabf5e9be064198d370cdbf19b5f2d.
2020-10-19Fixed #32116 -- Fixed QuerySet.order_by() crash on EmptyQuerySet with ↵Hannes Ljungberg
union() on a single non-empty ordered queryset.
2020-10-05Fixed #32068 -- Added error messages on get() with filters following ↵Hasan Ramezani
union(), intersection(), and difference().
2020-10-05Refs #32068 -- Added tests for get() following union(), intersection(), and ↵Hasan Ramezani
difference().
2020-09-17Fixed #31916 -- Fixed combined queryset crash when combining with ordered ↵Hasan Ramezani
combined querysets.
2020-09-16Fixed #31843 -- Fixed pickling named values from QuerySet.values_list().Kwist
2020-09-14Fixed #31990 -- Fixed QuerySet.ordered for GROUP BY queries on models with ↵Mariusz Felisiak
Meta.ordering. Regression in 0ddb4ebf7bfcc4730c80a772dd146a49ef6895f6. Thanks Julien Dutriaux for the report.
2020-08-24Refs #30897 -- Added test for WAL option to Queryset.explain() on PostgreSQL ↵Nick Pope
13+.
2020-07-31Fixed #27719 -- Added QuerySet.alias() to allow creating reusable aliases.Alexandr Tatarinov
QuerySet.alias() allows creating reusable aliases for expressions that don't need to be selected but are used for filtering, ordering, or as a part of complex expressions. Thanks Simon Charette for reviews.
2020-07-29Fixed #31783 -- Fixed crash when filtering againts "negate" field.Hasan Ramezani
Thanks Simon Charette for the initial patch.
2020-07-07Fixed #31767 -- Fixed QuerySet.none() on combined queryset.Mariusz Felisiak
2020-07-06Fixed #23797 -- Fixed QuerySet.exclude() when rhs is a nullable column.Jacob Walls
2020-06-08Fixed #31664 -- Reallowed using non-expressions having filterable attribute ↵Nicolas Baccelli
as rhs in queryset filters. Regression in 4edad1ddf6203326e0be4bdb105beecb0fe454c4.
2020-05-27Refs #31614 -- Added test for ordering by OrderBy() of combined queryset ↵Mariusz Felisiak
with not selected columns.
2020-05-26Fixed #31614 -- Fixed aliases ordering by OrderBy() expressions of combined ↵Laurent Tramoy
queryset.
2020-05-26Refs #31614 -- Added test for aliases ordering on combined querysets.Laurent Tramoy
2020-05-26Used operator.attrgetter() in test_qs_combinators.Laurent Tramoy
2020-05-19Fixed #31578 -- Dropped support for MySQL 5.6.Mariusz Felisiak
2020-05-15Refs #31395 -- Relied on setUpTestData() test data isolation in various tests.Simon Charette
2020-05-15Refs #13227 -- Adjusted a test to avoid making a shared test model unpickable.Simon Charette
This allowed the Note model to be used in setUpTestData() which requires assigned model instances to be copy.deepcopy()'able.
2020-05-13Fixed #31580 -- Added error messages on distinct() following union(), ↵Hasan Ramezani
intersection(), and difference().
2020-05-08Fixed #12990, Refs #27694 -- Added JSONField model field.sage
Thanks to Adam Johnson, Carlton Gibson, Mariusz Felisiak, and Raphael Michel for mentoring this Google Summer of Code 2019 project and everyone else who helped with the patch. Special thanks to Mads Jensen, Nick Pope, and Simon Charette for extensive reviews. Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2020-05-04Changed `'%s' % value` pattern to `str(value)`.Nick Pope
2020-04-06Fixed #31426 -- Added proper field validation to QuerySet.order_by().Simon Charette
Resolve the field reference instead of using fragile regex based string reference validation.
2020-04-06Refs #7098 -- Deprecated passing raw column aliases to order_by().Simon Charette
Now that order_by() has expression support passing RawSQL() can achieve the same result. This was also already supported through QuerySet.extra(order_by) for years but this API is more or less deprecated at this point.
2020-02-04Simplified imports from django.db and django.contrib.gis.db.Nick Pope
2020-01-09Fixed #31148 -- Added error messages on update()/delete() operations ↵Hasan Ramezani
following union(), intersection(), and difference().
2019-11-21Refs #25367 -- Made Query.build_filter() raise TypeError on non-conditional ↵Simon Charette
expressions.
2019-11-21Fixed #30484 -- Added conditional expressions support to CheckConstraint.Simon Charette
2019-11-21Refs #11964 -- Removed SimpleCol in favor of Query(alias_cols).Simon Charette
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.
2019-11-18Removed unnecessary parentheses in various code.Jon Dufresne
2019-11-18Fixed #30988 -- Deprecated the InvalidQuery exception.Simon Charette
It was barely documented without pointers at its defining location and was abused to prevent misuse of the QuerySet field deferring feature.
2019-11-13Fixed #30971 -- Prevented Query.resolve_lookup_value() from coercing list ↵George Marshall
values to tuples. Regression in 8a281aa7fe76a9da2284f943964a9413697cff1f.
2019-10-24Refs #30897 -- Added support for ANALYZE option to Queryset.explain() on ↵Nick Pope
MariaDB and MySQL 8.0.18+.
2019-10-24Refs #30897 -- Added support for TREE format to Queryset.explain() on MySQL ↵Nick Pope
8.0.16+.