-
This works - is it safe? await db.query("SELECT * FROM mytable WHERE id = ANY('{$1:csv}')", [1, 2, 3]) Or is there another recommended way of getting The docs give an example of how to use |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Is your question about how to format parameters differently? Please clarify what's the issue with the current code. This library is agnostic of the SQL syntax, as in it doesn't care if you use |
Beta Was this translation helpful? Give feedback.
-
In your code, you are making the same mistake as here and here. Proper usage for CSV filter: await db.query("SELECT * FROM mytable WHERE id = ANY($1:csv)", [req.body.ids]) or await db.query("SELECT * FROM mytable WHERE id = ANY(${ids:csv})", req.body) or await db.query("SELECT * FROM mytable WHERE id = ANY(${body.ids:csv})", req) But if you want an |
Beta Was this translation helpful? Give feedback.
In your code, you are making the same mistake as here and here.
Proper usage for CSV filter:
or
or
But if you want an
ARRAY
syntax there, then simply omit the:csv
part.