In sql package for postgresql jsonb how can I use the @>
operator with a string query for example
-
WHERE data @> '{"stringdata": $1}'
or -
WHERE data @> '{"stringdata": "$1"}'
doesn’t work
The alternative is data->>'string_data' = $1
which I don’t prefer for multiple statements
Error is:
"Message": "invalid input syntax for type json",
"Detail": "Token \"$\" is invalid.”,
"Where": "JSON data, line 1: $...",
"Routine": "report_invalid_token"