检查数组列中是否不存在多个值?

Check that multiple values do not exist in array column?

我正在尝试构建一个查询,其中 returns 条记录的 character varying[] 包含 多个值?类似于:

WHERE {char1,char2,char3} != ALL(char_array_col)

感谢任何帮助,谢谢。

如果数组中有多个值,您可以这样做:

where not myarray  @> array['val1', 'val2', 'val3']

这确保 myarray 不包含所有值。

另一方面,如果要确保 myarray 不包含 any 个值,请使用重叠运算符 &&:

where not myarray  && array['val1', 'val2', 'val3']