6 ms·
RE: expand array for in-clause, its definitely not supported automatically by node-postgres: http://stackoverflow.com/questions/10720420/node-postgres-how-to-e
by qooleot 12y ago
RE: expand array for in-clause, its definitely not supported automatically by node-postgres:
http://stackoverflow.com/questions/10720420/node-postgres-how-to-execute-where-col-in-dynamic-value-list-query http://stackoverflow.com/questions/10720420/node-postgres-ho...
https://github.com/brianc/node-postgres/issues/431 https://github.com/brianc/node-postgres/issues/431
which I confirmed:
promise catch err: { [error: invalid input syntax for integer: "{"45","56","33"}"]
but I can make this work by altering my 'sql' tagged template string function, and inspect for typeof <var> array and automatically expand. I wonder if there are there other purposes for arrays other than the in-clause syntax that I should check for.
- qooleot 12y agoFollowup on this. To avoid the in/not-in <array> expansion, the trick is actually to use: foo=any($1) where $1 is an array instead of in ($1, $2, etc.). != any($1) is the same as 'not in'.