I have an array of records. The record is something like (id, text_value)
And I'd like to search such in a WHERE
clause. I'd like to include rows which have a certain value within the array of records. However, the function ANY
, for example, seems to take equality as a single value. For example:
WHERE 'one' = ANY('{one,two}'::text[])
Whereas, my clause would be ANY(array_of_records)
. And the left hand side would therefore need to access a column in the record.
Is this possible in a WHERE clause, or should I use plpgsql to loop over the rows?
I'm also happy to use json
or jsonb
to do any array of records searching if that helps.