I have a column tags
, which is of type text array TEXT[]
. I can use the following query to retrieve rows that contain certain tags from the database:
SELECT * FROM records WHERE ('foobar' = ANY (tags));
This query retrieves all rows that contain a foobar
tag. This works fine.
Now, I'm in a situation where I need to search the tags
arrays for sub-strings. I tried the LIKE
operator with this query:
SELECT * FROM records WHERE ('%oo%' LIKE ANY (tags));
But it doesn't seem to work. Does anyone know how to achieve this?
I'm using Postgresql 10.3