summaryrefslogtreecommitdiff
path: root/tests/queries
AgeCommit message (Collapse)Author
2022-06-27[4.1.x] Fixed #33796 -- Fixed ordered combined queryset crash when used in ↵Mariusz Felisiak
subquery on PostgreSQL and MySQL. Thanks Shai Berger for the report. Regression in 30a01441347d5a2146af2944b29778fa0834d4be. Backport of 44ffd8d06fabc07d8333f31439e8dd39ea87329b from main
2022-05-04Refs #30581 -- Added Q.check() hook.Gagaro
2022-05-03Refs #30581 -- Added Q.flatten().Gagaro
2022-04-19Refs #32226 -- Fixed JSON format of QuerySet.explain() on PostgreSQL when ↵Mariusz Felisiak
format is uppercased. Follow up to aba9c2de669dcc0278c7ffde7981be91801be00b.
2022-04-14Relaxed some query ordering assertions in various tests.Mariusz Felisiak
It accounts for differences seen on MySQL with MyISAM storage engine.
2022-04-14Made select_for_update() don't raise TransactionManagementError on databases ↵Mariusz Felisiak
that don't support transactions.
2022-04-14Expanded QuerySet.explain() error message if a backend supports no formats.Tim Graham
2022-04-13Improved ExplainTests.test_basic().Mariusz Felisiak
QuerySet.select_for_update() is not supported by all databases. Moreover it cannot be used outside of a transaction.
2022-04-12Fixed #24296 -- Made QuerySet.exists() clear selected columns for not sliced ↵mgaligniana
distinct querysets.
2022-04-12Refs #18414 -- Added tests for selected columns of sliced distinct querysets.mgaligniana
2022-04-11Removed DatabaseFeatures.validates_explain_options.Mariusz Felisiak
Always True since 6723a26e59b0b5429a0c5873941e01a2e1bdbb81.
2022-04-11Fixed CVE-2022-28347 -- Protected QuerySet.explain(**options) against SQL ↵Mariusz Felisiak
injection on PostgreSQL.
2022-04-11Fixed CVE-2022-28346 -- Protected QuerySet.annotate(), aggregate(), and ↵Mariusz Felisiak
extra() against SQL injection in column aliases. Thanks Splunk team: Preston Elder, Jacob Davis, Jacob Moore, Matt Hanson, David Briggs, and a security researcher: Danylo Dmytriiev (DDV_UA) for the report.
2022-03-16Refs #30581 -- Allowed sql.Query to be used without model.Gagaro
2022-03-04Fixed #29865 -- Added logical XOR support for Q() and querysets.Ryan Heard
2022-02-25Fixed #31486 -- Deprecated passing unsaved objects to related filters.Albert Defler
Co-Authored-By: Hasan Ramezani <hasan.r67@gmail.com>
2022-02-22Removed redundant QuerySet.all() calls in docs and tests.Nick Pope
Most QuerySet methods are mapped onto the Manager and, in general, it isn't necessary to call .all() on the manager.
2022-02-09Fixed #33506 -- Made QuerySet.bulk_update() perform atomic writes against ↵Simon Charette
write database. The lack of _for_write = True assignment in bulk_update prior to accessing self.db resulted in the db_for_read database being used to wrap batched UPDATEs in a transaction. Also tweaked the batch queryset creation to also ensure they are executed against the same database as the opened transaction under all circumstances. Refs #23646, #33501.
2022-02-07Refs #33476 -- Refactored code to strictly match 88 characters line length.Mariusz Felisiak
2022-02-07Refs #33476 -- Reformatted code with Black.django-bot
2022-02-03Refs #33476 -- Refactored problematic code before reformatting by Black.Mariusz Felisiak
In these cases Black produces unexpected results, e.g. def make_random_password( self, length=10, allowed_chars='abcdefghjkmnpqrstuvwxyz' 'ABCDEFGHJKLMNPQRSTUVWXYZ' '23456789', ): or cursor.execute(""" SELECT ... """, [table name], )
2022-01-27Fixed #33463 -- Fixed QuerySet.bulk_update() with F() expressions.Jörg Breitbart
2022-01-17Fixed #29338 -- Allowed using combined queryset in Subquery.Mariusz Felisiak
Thanks Eugene Kovalev for the initial patch, Simon Charette for the review, and Chetan Khanna for help.
2021-12-08Fixed #33319 -- Fixed crash when combining with the | operator querysets ↵Ömer Faruk Abacı
with aliases that conflict.
2021-11-29Fixed #33322 -- Fixed loss of assigned related object when saving relation ↵Hannes Ljungberg
with bulk_update().
2021-11-19Refs #24121 -- Added __repr__() to BaseDatabaseWrapper, JoinPromoter, and ↵Jonny Park
SQLCompiler.
2021-10-08Refs #25467 -- Added test for excluding one-to-one relation with unsaved ↵Jacob Walls
objects. Fixed in 58da81a5a372a69f0bac801c412b57f3cce5f188.
2021-10-08Fixed tests.queries.models.StaffUser.__str__().Jacob Walls
2021-09-30Fixed #33159 -- Reverted "Fixed #32970 -- Changed WhereNode.clone() to ↵Mariusz Felisiak
create a shallow copy of children." This reverts commit e441847ecae99dd1ccd0d9ce76dbcff51afa863c. A shallow copy is not enough because querysets can be reused and evaluated in nested nodes, which shouldn't mutate JOIN aliases. Thanks Michal Čihař for the report.
2021-09-24Fixed #33127 -- Added error messages on | and & operators with combined ↵Hasan Ramezani
querysets.
2021-07-15Refs #32508 -- Raised Type/ValueError instead of using "assert" in ↵Daniyal
django.db.models. Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2021-07-05Fixed #32226 -- Fixed JSON format of QuerySet.explain() on PostgreSQL.Wu Haotian
2021-07-05Refs #28574 -- Added test for XML format output to Queryset.explain().Wu Haotian
2021-06-29Fixed #32381 -- Made QuerySet.bulk_update() return the number of objects ↵abhiabhi94
updated. Co-authored-by: Diego Lima <diego.lima@lais.huol.ufrn.br>
2021-05-13Fixed #32717 -- Fixed filtering of querysets combined with the | operator.Simon Charette
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.
2021-05-04Fixed #32693 -- Quoted and lowercased generated column aliases.Hasan Ramezani
2021-04-28Fixed #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.
2021-04-28Refs #32632 -- Added tests for returning a copy when combining Q() objects.Mariusz Felisiak
2021-04-22Used assertCountEqual() in ExcludeTests.test_exclude_subquery().Mariusz Felisiak
2021-04-21Fixed #32650 -- Fixed handling subquery aliasing on queryset combination.Simon Charette
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.
2021-04-12Fixed #32627 -- Fixed QuerySet.values()/values_list() crash on combined ↵Iuri de Silvio
querysets ordered by unannotated columns.
2021-03-17Fixed #32548 -- Fixed crash when combining Q() objects with boolean expressions.Jonathan Richards
2021-03-10Refs #32508 -- Raised TypeError instead of using "assert" on unsupported ↵Mariusz Felisiak
operations for sliced querysets.
2021-03-06Fixed #24141 -- Added QuerySet.contains().Johan Schiff
2021-02-18Fixed #32450 -- Fixed crash when ANDing/ORing an empty Q() with not ↵starryrbs
pickleable Q(). Regression in bb0b6e526340e638522e093765e534df4e4393d2.
2021-01-19Fixed #32357 -- Dropped support for PostgreSQL 9.6 and PostGIS 2.3.Mariusz Felisiak
2021-01-14Refs #7098 -- Removed support for passing raw column aliases to order_by().Mariusz Felisiak
Per deprecation timeline.
2021-01-14Refs #30988 -- Removed InvalidQuery exception per deprecation timeline.Mariusz Felisiak
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