Re: [Django] #31496: Combined queryset crash when chaining `values()` after `order_by()` with annotated constantants.

2020-04-22 Thread Django
#31496: Combined queryset crash when chaining `values()` after `order_by()` with
annotated constantants.
-+-
 Reporter:  GardenLee|Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  3.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Hasan Ramezani):

 I take a look and here is my understanding:

 In this case, when we order queryset by annotated value(`bar_val`) the
 
[https://github.com/django/django/blob/060d9d4229c436c44cf8e3a301f34c4b1f9f6c85/django/db/models/sql/compiler.py#L374
 src] variable,  has type `` and `src.output_field.name
 is None`.
 So,
 
[https://github.com/django/django/blob/060d9d4229c436c44cf8e3a301f34c4b1f9f6c85/django/db/models/sql/query.py#L1832
 add_select_col function] adds `None` to `values_select`.

 we should somehow add `bar_val` to the `values_select`.

 @felixxm, If you have any workaround, I can prepare a patch.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.83fa50379539ca4ad894fa168ee50591%40djangoproject.com.


Re: [Django] #31496: Combined queryset crash when chaining `values()` after `order_by()` with annotated constantants. (was: When using 'annotate', 'union', 'order_by('annotate_field')' and 'values' at

2020-04-21 Thread Django
#31496: Combined queryset crash when chaining `values()` after `order_by()` with
annotated constantants.
-+-
 Reporter:  GardenLee|Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  3.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by felixxm):

 * stage:  Unreviewed => Accepted


Comment:

 Thanks for this ticket. This code was changed in
 2cbd3967e0a51eab993df89679046d25ec78baec, however previously it raised
 `DatabaseError` so IMO it's not a release blocker. We can consider
 backporting if patch will be straightforward.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.8a662c950b94d73a2954c9bd2e28aac4%40djangoproject.com.