1   {orange_123,apple,grape}
2   {guava,apple_123,durian}
3   {strawberry_123,lime_123,leomon_123}
4   {mango_123,mangosteen,plum}
5   {plum,guava,peach}

For example with the above records…

I have to search the ID that has only the value in the array with “_123” as a suffix.

So I have to pick only this record.

3   {strawberry_123,lime_123,leomon_123}

But it doesn’t work.

with basket_tbl as (
select 1 as id, array['orange_123', 'apple', 'grape'] as item union
select 2 as id, array['guava', 'apple_123', 'durian'] as item union
select 3 as id, array['strawberry_123', 'lime_123', 'leomon_123'] as item union
select 4 as id, array['mango_123', 'mangosteen', 'plum'] as item union
select 5 as id, array['plum', 'guava', 'peach'] as item
)
SELECT * 
FROM basket_tbl bt
where '_123' like any(bt.item)

Is there any good idea?