summaryrefslogtreecommitdiff
path: root/tests/ordering
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2022-10-18 17:31:45 -0700
committerGitHub <noreply@github.com>2022-10-18 17:31:45 -0700
commitd62563cbb194c420f242bfced52b37d6638e67c6 (patch)
treebe2e41a3b8401040712d9452d8fa5861339880ac /tests/ordering
parent78470043ae4b8def7914badcd05bb1877c8a0aa4 (diff)
downloaddjango-d62563cbb194c420f242bfced52b37d6638e67c6.tar.gz
Fixed #34105 -- Fixed crash of ordering by nested selected expression.
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.
Diffstat (limited to 'tests/ordering')
-rw-r--r--tests/ordering/tests.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/ordering/tests.py b/tests/ordering/tests.py
index 88eeccf358..402e27d84b 100644
--- a/tests/ordering/tests.py
+++ b/tests/ordering/tests.py
@@ -12,7 +12,7 @@ from django.db.models import (
Subquery,
Value,
)
-from django.db.models.functions import Upper
+from django.db.models.functions import Length, Upper
from django.test import TestCase
from .models import (
@@ -599,3 +599,11 @@ class OrderingTests(TestCase):
OrderedByExpressionGrandChild.objects.order_by("parent"),
[g1, g2, g3],
)
+
+ def test_order_by_expression_ref(self):
+ self.assertQuerySetEqual(
+ Author.objects.annotate(upper_name=Upper("name")).order_by(
+ Length("upper_name")
+ ),
+ Author.objects.order_by(Length(Upper("name"))),
+ )