Changes between Initial Version and Version 4 of Ticket #31496
- Timestamp:
- Oct 6, 2020, 5:29:02 AM (4 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #31496
- Property Triage Stage Unreviewed → Accepted
- Property Summary When using 'annotate', 'union', 'order_by('annotate_field')' and 'values' at the same time, error occurred → Combined queryset crash when chaining `values()` after `order_by()` with annotated constants.
- Property Cc added
- Property Has patch set
- Property Owner changed from to
- Property Status new → assigned
-
Ticket #31496 – Description
initial v4 1 When itried query with 'annotate', 'union', 'order_by('annotate_field')' and 'values' at the same time, i got AttributeError('NoneType' object has no attribute 'split')1 When I tried query with 'annotate', 'union', 'order_by('annotate_field')' and 'values' at the same time, i got AttributeError('NoneType' object has no attribute 'split') 2 2 3 3 ex) 4 # 1. make 2 query_set 4 # 1. make 2 QuerySets 5 {{{ 5 6 qs1 = Foo.objects.annotate(bar_val=Value(1, output_field=IntegerField())).filter(bar=False) 6 7 qs2 = Foo.objects.annotate(bar_val=Value(2, output_field=IntegerField())).filter(bar=True) 8 }}} 9 7 10 8 11 # 2. union 9 qs3 = q1.union(q2) 12 {{{ 13 qs3 = qs1.union(qs2) 14 }}} 10 15 11 16 # 3. order_by annotate field 12 qs4 = q3.order_by('bar_val') 17 {{{ 18 qs4 = qs3.order_by('bar_val') 19 }}} 13 20 14 21 # 4. get values 15 q4.values('id') 22 {{{ 23 qs4.values('id') 24 }}} 16 25 17 26 In this case, I confirmed ('id', None) tuple passed by compiler.query.set_values() in django/db/models/sql/compiler.py