值数组 ILIKE 一些值

Array of values ILIKE some value

假设我有一个字符串数组 return 由某个子查询编辑。我想确保至少有一个元素与字符串匹配(例如:ILIKE "%alex%")。我该怎么办? 我的代码:

ANY(ARRAY["Alexander", "Michael", "John"]) ILIKE "%alex%"

根本不工作。 我需要一个在我的情况下 return 正确的解决方案,因为其中一个元素 (Alexander) 是 ILIKE "%alex%".

一种方法是使用 exists:

where exists (select 1 from unnest(ARRAY['Alexander', 'Michael', 'John']) el where el ILIKE '%alex%')