#35235: ArrayAgg() doesn't return default when filter contains __in=[].
----------------------------------+--------------------------------------
     Reporter:  Per Carlsen       |                    Owner:  Sharon Woo
         Type:  Bug               |                   Status:  assigned
    Component:  contrib.postgres  |                  Version:  5.0
     Severity:  Normal            |               Resolution:
     Keywords:  ArrayAgg          |             Triage Stage:  Accepted
    Has patch:  0                 |      Needs documentation:  0
  Needs tests:  0                 |  Patch needs improvement:  0
Easy pickings:  0                 |                    UI/UX:  0
----------------------------------+--------------------------------------
Comment (by David Sanders):

 Replying to [comment:10 Simon Charette]:
 > Foot gun that we could probably disarm by making
 `BaseExpression.output_field` a `@property` that clears the
 `_output_field_or_none` cache on assignment as I wouldn't be surprised
 other well intended `.output_field` assignments are not working as
 expected.

 Would there be any harm in simply removing `@cached_property` on
 `BaseExpression._output_field_or_none`? 🤔  It's body is simply:

 {{{
     @cached_property
     def _output_field_or_none(self):
         try:
             return self.output_field
         except FieldError:
             if not self._output_field_resolved_to_none:
                 raise
 }}}

 and `output_field` is already `@cached_property` as you mentioned, so it
 seems redundant. These 2 methods were both introduced as cached props when
 originally added by Josh in 2013. I just wonder whether Josh was being
 extra safe around the `FieldError` handling.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35235#comment:11>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018dcc2a0ae7-1a274f78-2c85-4b00-b3d6-1c7281ec586a-000000%40eu-central-1.amazonses.com.

Reply via email to