I'm trying to get rows where a column of type text[]
contains a value similar to some user input.
What I've thought and done so far is to use the 'ANY'
and 'LIKE
' operator like this:
select * from someTable where '%someInput%' LIKE ANY(someColum);
But it doesn't work. The query returns the same values as that this query:
select * from someTable where 'someInput' = ANY(someColum);
I've got good a result using the unnest()
function in a subquery but I need to query this in WHERE
clause if possible.
Why doesn't the LIKE
operator work with the ANY
operator and I don't get any errors? I thought that one reason should be that ANY
operator is in the right-hand of query, but ...
Is there any solution to this without using unnest()
and if it is possible in WHERE
clause?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…