#34552: Delaying get_from_clause call as much as possible.
-------------------------------------+-------------------------------------
     Reporter:  Matthew Schinckel    |                    Owner:  Matthew
                                     |  Schinckel
         Type:  New feature          |                   Status:  assigned
    Component:  Database layer       |                  Version:  4.2
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Simon Charette):

 If you need these changes it's likely [https://github.com/schinckel
 /django-shared-
 
property/blob/65b4d5664e503c2b53bbd68f99561e0ea2e3f734/src/django_shared_property/expressions.py#L75
 because you are performing expression resolving] during the compilation
 phase which is known to cause subtle issues with regards to join reuse and
 compilation in general e.g. what if your newly referenced expressions
 trigger aggregation or filter against window functions, now you have an
 improper `order_by`

 It feels like this feature should be implementable by using
 `QuerySet.alias` if the latter was implemented in a way that deferred any
 form of joining until the alias is first referenced. Am I right in the
 assessment that you implemented your expression resolving in `as_sql`
 because you wanted to avoid unnecessary JOINs and that if `QuerySet.alias`
 allowed you to stash `ordering=models.F('ord__a') / models.F('ord__b')`
 without joining into `ord__` until `ordering` is referenced then you could
 implement the same feature by simply having `shared_property` augment the
 managers querysets with the alias you defined?

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34552#comment:5>
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070188009da900-09383411-a761-47a2-9d23-a6a1dd9041b9-000000%40eu-central-1.amazonses.com.

Reply via email to