Opened 7 years ago

Last modified 4 years ago

#27824 closed New feature

Cannot chain unaccent transform with key lookup in Postgres JSON field — at Version 1

Reported by: Aymeric Augustin Owned by:
Component: contrib.postgres Version: dev
Severity: Normal Keywords:
Cc: Simon Charette, olau@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Aymeric Augustin)

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.

Change History (1)

comment:1 by Aymeric Augustin, 7 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top