I'm trying to build a query that returns records that have a character varying[] column that does not contain multiple values? Something like:
WHERE {char1,char2,char3} != ALL(char_array_col)
Any help appreciated, thank you.
If you have your multiple values in an array, you can do:
where not myarray @> array['val1', 'val2', 'val3']
This ensures that myarray does not contain all of the values.
On the other hand, if you want to ensure that myarray does not contain any of the values, use overlap operator &&:
where not myarray && array['val1', 'val2', 'val3']
"No operator matches the given name and argument types. You might need to add explicit type casts."cast: where not myarray && array['val1', 'val2', 'val3']::character varying[]pet IS NULL OR NOT pet && '{cat,dog}' worked. Thanks for your help.