<feed xmlns='http://www.w3.org/2005/Atom'>
<title>django.git/tests/ordering/tests.py, branch stable/5.2.x</title>
<subtitle>django
</subtitle>
<id>http://cgit.adnoto.dev/django.git/atom?h=stable%2F5.2.x</id>
<link rel='self' href='http://cgit.adnoto.dev/django.git/atom?h=stable%2F5.2.x'/>
<link rel='alternate' type='text/html' href='http://cgit.adnoto.dev/django.git/'/>
<updated>2026-02-03T13:19:02Z</updated>
<entry>
<title>[5.2.x] Refs CVE-2026-1312 -- Raised ValueError when FilteredRelation aliases contain periods.</title>
<updated>2026-02-03T13:19:02Z</updated>
<author>
<name>Jacob Walls</name>
<email>jacobtylerwalls@gmail.com</email>
</author>
<published>2026-01-21T23:00:13Z</published>
<link rel='alternate' type='text/html' href='http://cgit.adnoto.dev/django.git/commit/?id=ab0ad8d39555292b55123adeac57ed64c776f8d9'/>
<id>urn:sha1:ab0ad8d39555292b55123adeac57ed64c776f8d9</id>
<content type='text'>
This prevents failures at the database layer, given that aliases in the
ON clause are not quoted.

Systematically quoting aliases even in FilteredRelation is tracked in
https://code.djangoproject.com/ticket/36795.

Backport of 005d60d97c4dfb117503bdb6f2facfcaf9315d84 from main.
</content>
</entry>
<entry>
<title>[5.2.x] Fixed CVE-2026-1312 -- Protected order_by() from SQL injection via aliases with periods.</title>
<updated>2026-02-03T13:18:30Z</updated>
<author>
<name>Jacob Walls</name>
<email>jacobtylerwalls@gmail.com</email>
</author>
<published>2026-01-21T22:53:52Z</published>
<link rel='alternate' type='text/html' href='http://cgit.adnoto.dev/django.git/commit/?id=e863ee273c6553e9b6fa4960a17acb535851857b'/>
<id>urn:sha1:e863ee273c6553e9b6fa4960a17acb535851857b</id>
<content type='text'>
Before, `order_by()` treated a period in a field name as a sign that it
was requested via `.extra(order_by=...)` and thus should be passed
through as raw table and column names, even if `extra()` was not used.
Since periods are permitted in aliases, this meant user-controlled
aliases could force the `order_by()` clause to resolve to a raw table
and column pair instead of the actual target field for the alias.

In practice, only `FilteredRelation` was affected, as the other
expressions we tested, e.g. `F`, aggressively optimize away the ordering
expressions into ordinal positions, e.g. ORDER BY 2, instead of ORDER BY
"table".column.

Thanks Solomon Kebede for the report, and Simon Charette and Jake Howard
for reviews.

Backport of 69065ca869b0970dff8fdd8fafb390bf8b3bf222 from main.
</content>
</entry>
<entry>
<title>Fixed #34372 -- Fixed queryset crash on order by aggregation using OrderBy.</title>
<updated>2023-02-27T06:10:19Z</updated>
<author>
<name>Simon Charette</name>
<email>charette.s@gmail.com</email>
</author>
<published>2023-02-27T06:10:19Z</published>
<link rel='alternate' type='text/html' href='http://cgit.adnoto.dev/django.git/commit/?id=b15f162f252610e3b510ade465549769ab4356cf'/>
<id>urn:sha1:b15f162f252610e3b510ade465549769ab4356cf</id>
<content type='text'>
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.</content>
</entry>
<entry>
<title>Fixed #34346 -- Ordered selected expressions by position.</title>
<updated>2023-02-20T04:54:25Z</updated>
<author>
<name>Simon Charette</name>
<email>charette.s@gmail.com</email>
</author>
<published>2023-02-18T01:38:08Z</published>
<link rel='alternate' type='text/html' href='http://cgit.adnoto.dev/django.git/commit/?id=278881e37619278789942513916acafaa88d26f3'/>
<id>urn:sha1:278881e37619278789942513916acafaa88d26f3</id>
<content type='text'>
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.
</content>
</entry>
<entry>
<title>Refs #33308 -- Added tests for queryset ordered by annotation with nulls_first/nulls_last.</title>
<updated>2023-02-18T15:28:10Z</updated>
<author>
<name>Simon Charette</name>
<email>charettes@users.noreply.github.com</email>
</author>
<published>2023-02-18T13:53:08Z</published>
<link rel='alternate' type='text/html' href='http://cgit.adnoto.dev/django.git/commit/?id=a6511bc23329f1d3939571ad01d3176f8f6cb786'/>
<id>urn:sha1:a6511bc23329f1d3939571ad01d3176f8f6cb786</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Fixed #34105 -- Fixed crash of ordering by nested selected expression.</title>
<updated>2022-10-19T00:31:45Z</updated>
<author>
<name>Simon Charette</name>
<email>charette.s@gmail.com</email>
</author>
<published>2022-10-19T00:31:45Z</published>
<link rel='alternate' type='text/html' href='http://cgit.adnoto.dev/django.git/commit/?id=d62563cbb194c420f242bfced52b37d6638e67c6'/>
<id>urn:sha1:d62563cbb194c420f242bfced52b37d6638e67c6</id>
<content type='text'>
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.</content>
</entry>
<entry>
<title>Refs #33990 -- Renamed TransactionTestCase.assertQuerysetEqual() to assertQuerySetEqual().</title>
<updated>2022-10-08T06:07:38Z</updated>
<author>
<name>Gregor Gärtner</name>
<email>code@gregorgaertner.de</email>
</author>
<published>2022-09-24T10:29:58Z</published>
<link rel='alternate' type='text/html' href='http://cgit.adnoto.dev/django.git/commit/?id=f0c06f8ab7904e1fd082f2de57337f6c7e05f177'/>
<id>urn:sha1:f0c06f8ab7904e1fd082f2de57337f6c7e05f177</id>
<content type='text'>
Co-Authored-By: Michael Howitz &lt;mh@gocept.com&gt;
</content>
</entry>
<entry>
<title>Fixed #34012 -- Made QuerySet.order_by() apply transforms on related fields for models with Meta.ordering.</title>
<updated>2022-10-04T06:19:34Z</updated>
<author>
<name>David Sanders</name>
<email>shang.xiao.sanders@gmail.com</email>
</author>
<published>2022-09-17T15:44:37Z</published>
<link rel='alternate' type='text/html' href='http://cgit.adnoto.dev/django.git/commit/?id=4771a1694b3b54c7309602820881d3ec9cc2c809'/>
<id>urn:sha1:4771a1694b3b54c7309602820881d3ec9cc2c809</id>
<content type='text'>
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.
</content>
</entry>
<entry>
<title>Fixed #29538 -- Fixed crash of ordering by related fields when Meta.ordering contains expressions.</title>
<updated>2022-05-12T05:19:16Z</updated>
<author>
<name>Ed Rivas</name>
<email>ed@jerivas.com</email>
</author>
<published>2022-05-05T00:10:53Z</published>
<link rel='alternate' type='text/html' href='http://cgit.adnoto.dev/django.git/commit/?id=2798c937deb6625a4e6a36e70d4d60ce5faac954'/>
<id>urn:sha1:2798c937deb6625a4e6a36e70d4d60ce5faac954</id>
<content type='text'>
Thanks Simon Charette for the review.
</content>
</entry>
<entry>
<title>Removed redundant QuerySet.all() calls in docs and tests.</title>
<updated>2022-02-22T09:29:38Z</updated>
<author>
<name>Nick Pope</name>
<email>nick@nickpope.me.uk</email>
</author>
<published>2022-02-22T09:29:38Z</published>
<link rel='alternate' type='text/html' href='http://cgit.adnoto.dev/django.git/commit/?id=847f46e9bf88964484c8b76a10af753ea1018311'/>
<id>urn:sha1:847f46e9bf88964484c8b76a10af753ea1018311</id>
<content type='text'>
Most QuerySet methods are mapped onto the Manager and, in general,
it isn't necessary to call .all() on the manager.</content>
</entry>
</feed>
