Opened 10 years ago
Last modified 10 years ago
#24169 closed Bug
ArrayField can't use __contained_by or __overlap queries for CharField — at Initial Version
Description ¶
ArrayField's lookup.py uses the @> operator for contains, the <@ operator for contained_by, and the && operator for overlap.
When the field uses CharField (Postgres' varchar()), contains works, but contained_by and overlap do not, as Postgres does not define <@ and && operators for an array of varchar[] (it does for text[]).
contains works because, in array.py, there is a custom lookup, "ArrayOverlap", the outputs a cast to cast the array query value to, say, "::varchar(10)[]"
If there are similar custom lookups for contained_by and overlap, these then work.