I am trying to pass an array of parameters in pg-promise's array of parameters, as recommended in pg-promise docs.
db.any("SELECT fieldname FROM table WHERE fieldname = $1 AND fieldname2 IN ($2)",
[1,[[1730442],[1695256]],[487413],[454336]]])
.then(function (data) {
console.log("DATA:", data); // print data;
})
.catch();
But it doesn't work, I'm returned a "missing ) after argument list" error. Or an "operator does not exist: integer = integer[]]" error, if I replace the parameters by :
[1,[1730442]]
Of course if I pass it like this, it works :
[1,1730442]
Is it the proper way of passing an array of values when other parameters are involved?
I also tried to remove the parenthesis around the $2, without success.