#27824: Cannot chain unaccent transform with key lookup in Postgres JSON field
--------------------------------------------+------------------------
               Reporter:  Aymeric Augustin  |          Owner:  (none)
                   Type:  New feature       |         Status:  new
              Component:  contrib.postgres  |        Version:  1.10
               Severity:  Normal            |       Keywords:
           Triage Stage:  Unreviewed        |      Has patch:  0
    Needs documentation:  0                 |    Needs tests:  0
Patch needs improvement:  0                 |  Easy pickings:  0
                  UI/UX:  0                 |
--------------------------------------------+------------------------
 With the following model:

 ```
 from django.contrib.postgres.fields import JSONField
 from django.db import models


 class Subscription(models.Model):
     inputs = JSONField()
 ```

 I'd like this query to work (assuming a inputs look like `{'first_name':
 '...'}`:

 ```
 Subscription.objects.filter(inputs__first_name__unaccent__icontains="...")
 ```

 But it fails with:

 ```
 django.db.utils.ProgrammingError: operator does not exist: jsonb #> text
 LINE 1: ...%' OR UPPER("subscriptions_subscription"."inputs" #> ARRAY['...
                                                              ^
 HINT:  No operator matches the given name and argument type(s). You might
 need to add explicit type casts.
 ```

 cecef94275118dc49a1b0d89d3ca9734e2ec9776 registered a bunch of lookups for
 chaining after a key transform, but unaccent wasn't included. I suggest to
 include it as well.

--
Ticket URL: <https://code.djangoproject.com/ticket/27824>
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/052.bd056c8adf8c0e2232b2b990ee60539d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to