79621476

Date: 2025-05-14 12:37:48
Score: 0.5
Natty:
Report link

After quite a bit of fiddling around, I found out I can make use of CONCAT, as long as I cast it properly:

SELECT * FROM my_table
WHERE my_col->'my_field' @> ('["' || :dyn_val! || '"]')::jsonb;

This behaves as expected: it uses my dynamic string, encloses it in with the right syntax and once casted as jsonb, can be used with the @> operator.

Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: chris