When Django's ORM translates a JSONB query using CONTAINS into SQL it uses the ->> operator which is working fine.
For example, something like:
"metadata__my_field_name__icontains": "1234"
runs as:
...WHERE UPPER(("table"."metadata" ->> my_field_name)::text) LIKE UPPER(%1234%)...
which works great.
However, when I try to use the IN operator and a list of values:
"metadata__my_field_name__in": my_list
the SQL generated uses the JSON, as opposed to JSONB operator like this:
..."table"."metadata" -> 'my_id') IN ('1234', '3456', ...
While it runs, it does not return the expected values (empty set). By contrast, if I manually run the same query using the JSONB operator, ->>, the expected values are returned. Note also, that the IDs are converted to strings. I'm running Django 2.2.
Is there a way to force Django to use the JSONB operator?