I have a little problem with building a query using CB and Postgres. I have a jsonb field and I need a filter on the value item of this json and more items, too. I have not got too much experience with CB API and I don't know if it is suitable for my problem or not at all.
In any of my solutions CB generate an SQL where value(jsonb_each_text(pd.dsjson)) expression placed in the where clause and this solution is bleeding.
The naked select what I need is:
select
t1_0.id,
c1_0.id,
jsonquery.jsonb_value
from
task t1_0
join
campaign c1_0
on t1_0.id=c1_0.task_id
join (SELECT value(jsonb_each_text(pd.dsjson)) AS jsonb_value, pd.campaign_uuid c_id
FROM datasource pd) as jsonquery
on c1_0.id = c_id
where
jsonquery.jsonb_value LIKE '%aaa%';
really thanks for any help
... WHERE value(jsonb_each_text(dsjson)) like "%aaa%"
is not working:
SQL Error [0A000]: ERROR: set-returning functions are not allowed in WHERE