Hi there is there anyone using Postgres JSONB operators with Hugsql? I am seeing this
[SELECT * FROM reports
│ WHERE image_descriptors @> '[{"image-id":"' ? '"}]'; fe4cf22c-6779-492f-b2a0-f7180c00a964]
But it does not work at the moment - original query being
-- :name report-by-image-id :? :*
SELECT * FROM reports
WHERE image_descriptors @> '[{"image-id":"' :image-id '"}]';
I think you should concatenate your strings in SQL: @> '[{"image-id":"' || :image-id || '"}]';
thanks Curtis for your answer, that makes sense I eventually went for
SELECT * FROM reports
WHERE image_descriptors @> jsonb_build_array(json_build_object('image-id', :image-id));