OK I tried that and see it works with the cast. But now I'm confused about both what exactly is failing without the cast, and about the resulting error message.
Is the query failing because PG doesn't understand the subquery is yielding an array? Seems unlikely. But if the problem is a type mismatch between 'test' (on the left) and my subquery, I'd expect the same error message as if I try to compare an int to a text array:
SELECT 'found' WHERE 1 = ANY( (SELECT ARRAY['test','pass','fail']));
ERROR: operator does not exist: integer = text[]
LINE 1: SELECT 'found' WHERE 1 = ANY( (SELECT ARRAY['test','pass','f...
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
Instead of the error message I actually got:
ERROR: array value must start with "{" or dimension information
Thanks.
Ken