mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
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 04518e310d.
Thanks Matt Westcott for the report.
This commit is contained in:
@@ -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"))),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user