summaryrefslogtreecommitdiff
path: root/tests/queries
Commit message (Collapse)AuthorAgeFilesLines
* Fixed #28553 -- Fixed annotation mismatch with ↵David Wobrock2023-03-241-1/+15
| | | | | | QuerySet.values()/values_list() on compound queries. Co-authored-by: Matthias Kestenholz <mk@feinheit.ch>
* Refs #31445 -- Added test for nesting QuerySet.union().Mariusz Felisiak2023-02-211-0/+9
| | | This was fixed in MySQL 8.0.31.
* Fixed #34267 -- Fixed sliced QuerySet.union() crash.Francesco Panico2023-01-201-4/+12
| | | | | | Regression in 3d734c09ff0138441dfe0a59010435871d17950f. Thanks Raphaël Stefanini for the report.
* Refs #31486 -- Removed ability to pass unsaved model instances to related ↵Mariusz Felisiak2023-01-171-27/+9
| | | | | | filters. Per deprecation timeline.
* Removed unnecessary commas in tests.Mariusz Felisiak2022-12-211-3/+1
|
* Refs #33308 -- Avoided passing None to RawSQL's params.Florian Apolloner2022-12-021-4/+3
| | | | | Passing None to params causes errors in determining the data type on psycopg3.
* Refs #33050 -- Added test for QuerySet.count() on combined queries with ↵Mariusz Felisiak2022-11-231-0/+6
| | | | | | | select_related(). Thanks Simon Charette for noticing this. Fixed in 70499b25c708557fb9ee2264686cd172f4b2354e.
* Fixed #34123 -- Fixed combinator order by alias when using select_related().Simon Charette2022-11-151-0/+28
| | | | | | | | Regression in c58a8acd413ccc992dd30afd98ed900897e1f719. Thanks to Shai Berger for the report and tests. Co-Authored-By: David Sanders <shang.xiao.sanders@gmail.com>
* Refs #33374 -- Adjusted full match condition handling.Simon Charette2022-11-071-7/+13
| | | | | | 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.
* Fixed #16211 -- Added logical NOT support to F expressions.David Wobrock2022-10-311-2/+2
|
* Fixed #34125 -- Fixed sliced QuerySet.union() crash on a single non-empty ↵Simon Charette2022-10-291-0/+26
| | | | | | | | | 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.
* Refs #33990 -- Renamed TransactionTestCase.assertQuerysetEqual() to ↵Gregor Gärtner2022-10-082-28/+28
| | | | | | assertQuerySetEqual(). Co-Authored-By: Michael Howitz <mh@gocept.com>
* Replaced assertQuerysetEqual() to assertSequenceEqual()/assertCountEqual() ↵Mariusz Felisiak2022-10-071-23/+23
| | | | | where appropriate. Follow up to 3f7b3275627385f8f7531fca01cdda50d4ec6b6e.
* Fixed #33768 -- Fixed ordering compound queries by nulls_first/nulls_last on ↵Simon Charette2022-10-051-0/+18
| | | | | | | | | | | 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.
* Fixed #34012 -- Made QuerySet.order_by() apply transforms on related fields ↵David Sanders2022-10-041-0/+3
| | | | | | | | | | | 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.
* Refs #34012 -- Added test for ordering by transform of related fields.Mariusz Felisiak2022-09-221-0/+14
|
* Fixed #34015 -- Allowed filtering by transforms on relation fields.Mariusz Felisiak2022-09-222-3/+33
|
* Fixed #21204 -- Tracked field deferrals by field instead of models.Simon Charette2022-08-301-6/+0
| | | | | This ensures field deferral works properly when a model is involved more than once in the same query with a distinct deferral mask.
* Refs #32948, Refs #32946 -- Used Q.create() internally for dynamic Q() objects.Nick Pope2022-07-271-0/+9
| | | | | | | | | Node.create() which has a compatible signature with Node.__init__() takes in a single `children` argument rather than relying in unpacking *args in Q.__init__() which calls Node.__init__(). In addition, we were often needing to unpack iterables into *args and can instead pass a list direct to Node.create().
* Used AND, OR, XOR constants instead of hard-coded values.Nick Pope2022-07-273-11/+11
|
* Fixed #33796 -- Fixed ordered combined queryset crash when used in subquery ↵Mariusz Felisiak2022-06-271-0/+22
| | | | | | | | on PostgreSQL and MySQL. Thanks Shai Berger for the report. Regression in 30a01441347d5a2146af2944b29778fa0834d4be.
* Made QuerySet.bulk_update() raise an error when batch_size is zero.Ebram Shehata2022-06-131-0/+2
|
* Fixed #33717 -- Dropped support for PostgreSQL 11.Mariusz Felisiak2022-05-191-2/+1
|
* Refs #30581 -- Added Q.check() hook.Gagaro2022-05-041-1/+39
|
* Refs #30581 -- Added Q.flatten().Gagaro2022-05-031-1/+27
|
* Refs #32226 -- Fixed JSON format of QuerySet.explain() on PostgreSQL when ↵Mariusz Felisiak2022-04-191-2/+4
| | | | | format is uppercased. Follow up to aba9c2de669dcc0278c7ffde7981be91801be00b.
* Relaxed some query ordering assertions in various tests.Mariusz Felisiak2022-04-141-2/+2
| | | It accounts for differences seen on MySQL with MyISAM storage engine.
* Made select_for_update() don't raise TransactionManagementError on databases ↵Mariusz Felisiak2022-04-141-12/+4
| | | | that don't support transactions.
* Expanded QuerySet.explain() error message if a backend supports no formats.Tim Graham2022-04-141-0/+2
|
* Improved ExplainTests.test_basic().Mariusz Felisiak2022-04-131-7/+14
| | | | QuerySet.select_for_update() is not supported by all databases. Moreover it cannot be used outside of a transaction.
* Fixed #24296 -- Made QuerySet.exists() clear selected columns for not sliced ↵mgaligniana2022-04-121-0/+8
| | | | distinct querysets.
* Refs #18414 -- Added tests for selected columns of sliced distinct querysets.mgaligniana2022-04-121-0/+8
|
* Removed DatabaseFeatures.validates_explain_options.Mariusz Felisiak2022-04-111-1/+0
| | | Always True since 6723a26e59b0b5429a0c5873941e01a2e1bdbb81.
* Fixed CVE-2022-28347 -- Protected QuerySet.explain(**options) against SQL ↵Mariusz Felisiak2022-04-111-2/+31
| | | | injection on PostgreSQL.
* Fixed CVE-2022-28346 -- Protected QuerySet.annotate(), aggregate(), and ↵Mariusz Felisiak2022-04-111-0/+9
| | | | | | | | 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.
* Refs #30581 -- Allowed sql.Query to be used without model.Gagaro2022-03-161-3/+62
|
* Fixed #29865 -- Added logical XOR support for Q() and querysets.Ryan Heard2022-03-043-0/+76
|
* Fixed #31486 -- Deprecated passing unsaved objects to related filters.Albert Defler2022-02-251-1/+29
| | | | Co-Authored-By: Hasan Ramezani <hasan.r67@gmail.com>
* Removed redundant QuerySet.all() calls in docs and tests.Nick Pope2022-02-223-14/+14
| | | | Most QuerySet methods are mapped onto the Manager and, in general, it isn't necessary to call .all() on the manager.
* Fixed #33506 -- Made QuerySet.bulk_update() perform atomic writes against ↵Simon Charette2022-02-091-1/+27
| | | | | | | | | | | | | | 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.
* Refs #33476 -- Refactored code to strictly match 88 characters line length.Mariusz Felisiak2022-02-071-4/+10
|
* Refs #33476 -- Reformatted code with Black.django-bot2022-02-0711-1554/+2110
|
* Refs #33476 -- Refactored problematic code before reformatting by Black.Mariusz Felisiak2022-02-031-2/+1
| | | | | | | | | | | | | | | | | 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], )
* Fixed #33463 -- Fixed QuerySet.bulk_update() with F() expressions.Jörg Breitbart2022-01-271-0/+10
|
* Fixed #29338 -- Allowed using combined queryset in Subquery.Mariusz Felisiak2022-01-171-2/+35
| | | | Thanks Eugene Kovalev for the initial patch, Simon Charette for the review, and Chetan Khanna for help.
* Fixed #33319 -- Fixed crash when combining with the | operator querysets ↵Ömer Faruk Abacı2021-12-082-2/+23
| | | | with aliases that conflict.
* Fixed #33322 -- Fixed loss of assigned related object when saving relation ↵Hannes Ljungberg2021-11-291-1/+31
| | | | with bulk_update().
* Refs #24121 -- Added __repr__() to BaseDatabaseWrapper, JoinPromoter, and ↵Jonny Park2021-11-192-1/+26
| | | | SQLCompiler.
* Refs #25467 -- Added test for excluding one-to-one relation with unsaved ↵Jacob Walls2021-10-081-0/+8
| | | | | | objects. Fixed in 58da81a5a372a69f0bac801c412b57f3cce5f188.
* Fixed tests.queries.models.StaffUser.__str__().Jacob Walls2021-10-081-1/+1
|