I have a table with the next jsonb field -
{ "auth": [{"roles": ["role1", "role2"]}]}
When I do this query -
select jsonb_array_elements(role) as role from (
select x -> 'roles' as role
from test,
jsonb_array_elements(data->'auth') x
the output format is
role
----
"role1"
"role2"
The current problem is that if I try to add where it doesn't work
x.role = '"role1"', but this one does work x.role like '%"role1"%'
Thanks