mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #31956 -- Fixed crash of ordering by JSONField with a custom decoder on PostgreSQL.
Thanks Marc Debureaux for the report. Thanks Simon Charette, Nick Pope, and Adam Johnson for reviews.
This commit is contained in:
@@ -359,6 +359,18 @@ class TestQuerying(TestCase):
|
||||
).values('value__d__0').annotate(count=Count('value__d__0')).order_by('count')
|
||||
self.assertQuerysetEqual(qs, [1, 11], operator.itemgetter('count'))
|
||||
|
||||
def test_order_grouping_custom_decoder(self):
|
||||
NullableJSONModel.objects.create(value_custom={'a': 'b'})
|
||||
qs = NullableJSONModel.objects.filter(value_custom__isnull=False)
|
||||
self.assertSequenceEqual(
|
||||
qs.values(
|
||||
'value_custom__a',
|
||||
).annotate(
|
||||
count=Count('id'),
|
||||
).order_by('value_custom__a'),
|
||||
[{'value_custom__a': 'b', 'count': 1}],
|
||||
)
|
||||
|
||||
def test_key_transform_raw_expression(self):
|
||||
expr = RawSQL(self.raw_sql, ['{"x": "bar"}'])
|
||||
self.assertSequenceEqual(
|
||||
|
||||
Reference in New Issue
Block a user