I have a a table account with the following columns:
id | integer
username | character varying(30)
data | jsonb
In data column, I am saving an array of user addresses along with the location. The sql statement to select location from the table works as raw query but trying it with the prepared format that pg or any other orm offers is not working for me.
The query format is:
pg.query("SELECT * FROM account where data->'addresses' @> '[{"location":"$1"}]'", ['Berlin']).
It throws the following error:
could not determine data type of parameter $1
I know that raw query could also be used instead but I am considering the security as well here