#29172: Using Window in Subquery causes AttributeError
-------------------------------------+-------------------------------------
               Reporter:  Tomáš      |          Owner:  nobody
  Ehrlich                            |
                   Type:  Bug        |         Status:  assigned
              Component:  Database   |        Version:  2.0
  layer (models, ORM)                |       Keywords:  subquery window
               Severity:  Normal     |  expression orm
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 Using Window expression within Subquery causes an `AttributeError:
 'NoneType' object has no attribute ‘relabeled_clone'`

 Error is raised in `relabeled_clone` method,
 
https://github.com/django/django/blob/master/django/db/models/expressions.py#L319
 which calls `e.relabeled_clone` method on every expression returned from
 `get_source_expressions`.

 Window expression returns `source_expression`, `partition_by`, `order_by`
 and `frame` in `get_source_expression`:
 
https://github.com/django/django/blob/master/django/db/models/expressions.py#L1188
 but all parameters except `source_expression` are optional and might be
 `None`. This leads to AttributeError.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29172>
Django <https://code.djangoproject.com/>
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 post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/053.431ae08590b75a2083c2e6c0293470d1%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to