#35491: QuerySet.extra use case. Unnest array and make it lower. and make it an
array again.
-------------------------------------+-------------------------------------
               Reporter:  june       |          Owner:  nobody
                   Type:  New        |         Status:  new
  feature                            |
              Component:  Database   |        Version:  4.2
  layer (models, ORM)                |
               Severity:  Normal     |       Keywords:  QuerySet.extra
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 I had used extra() for annotating Arrayfield with lower cases and filter
 out with another array intersection.

 Below is what I used for

 ```
         lower_value = [v.lower() for v in value]
         numbers = Numeric.objects.extra(
             where=[f"ARRAY(SELECT lower(unnest({array_field}))) &&
 %s::text[]"],
             params=[lower_value],
         )
 ```

 I need to unnest arrayfield first and make each elements lowercase, and
 make it an Array again.
 and then need to check overlay with another array.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35491>
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/0107018fc9cc6ce1-20c53536-bfad-4ec3-9c92-135ad6de5d14-000000%40eu-central-1.amazonses.com.

Reply via email to