contains, jsonb, array of arrays


I have 2 SQLs, both return true:

select ‘[[“a”,“b”],[“b”]]’::jsonb @> ‘[[“b”]]’::jsonb
select ‘[[“a”,“b”]]’::jsonb @> ‘[[“b”]]’::jsonb

I have expected that the second one return false.

I am wondering how can I test the second one for false.

For now I am splitting the first expression in text components:

select ‘[[“b”]]’ in (select jsonb_array_elements_text(’[[“a”,“b”],[“b”]]’::jsonb))

But I find the solution rudimentary and slow.


you can ask my colleague Andrew Dunstan (don’t forget to say hi from me), i think, he can help you. Please keep us informed here.

Btw.: this is a german speaking forum, can we switch to german?