Is there a way to do a partial string match on a string array column in postgres?
I’m trying the following syntax, but it is not working as I’d expect it to:
SELECT * FROM example_table WHERE '%partial string' ILIKE ANY(array_column)
Is there a correct way of doing this?
Advertisement
Answer
drop table if exists temp_a; create temp table temp_a as ( select array['alpha','beta'] as strings union all select array['gamma','theta'] ); select * from (select unnest(strings) as string from temp_a) as sq where string ilike '%eta'