1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +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:
Simon Charette
2022-10-18 17:31:45 -07:00
committed by GitHub
parent 78470043ae
commit d62563cbb1
2 changed files with 10 additions and 7 deletions

View File

@@ -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"))),
)