#29429: Make len lookup for ArrayField use the array_length function
-------------------------------------+-------------------------------------
     Reporter:  creative3000         |                    Owner:  (none)
         Type:  Bug                  |                   Status:  closed
    Component:  contrib.postgres     |                  Version:  2.0
     Severity:  Normal               |               Resolution:  needsinfo
     Keywords:  db orm ArrayField    |             Triage Stage:  Accepted
  postgres                           |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Claude Paroz):

 * status:  new => closed
 * resolution:   => needsinfo


Comment:

 Are you sure the line
 `Post.objects.all().annotate(tag_len=F('tags__len'))` is valid?
 Where did you read in the documentation a similar construct with a
 Transform inside a `F()` expression?

 In my opinion, you should have written:
 {{{
 from django.contrib.postgres.fields.array import ArrayLenTransform
 Post.objects.all().annotate(tag_len=ArrayLenTransform('tags'))
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29429#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/070.db7b2344f82db03ecfc740c194feb7ad%40djangoproject.com.

Reply via email to