Consider the following table
id int | lang_codes text[] |
---|---|
1 | {eng,fre} |
2 | {eng} |
I need to select all the rows from the table that intersect with the input array, but only when all the items in the lang_codes
are present in the input array, e.g.:
I've tried the && operand, but it returns all the rows:
select * from my_table where lang_codes && ARRAY['eng','ger'];
From the other hand @> operand, returns only when array matches fully
The <@
operator should do the trick:
select * from my_table where lang_codes <@ ARRAY['eng','ger'];