mirror of
https://github.com/django/django.git
synced 2025-11-25 05:04:26 +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:
parent
78470043ae
commit
d62563cbb1
2 changed files with 10 additions and 7 deletions
|
|
@ -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"))),
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue