I am trying to run the query:
let query =
`
DELETE FROM
${table_name}
WHERE
_id IN ($1::bigint[])
AND
account_id = $2
`
let fields =
[
_ids,
account_id,
]
but it's giving me the error:
operator does not exist: bigint = bigint[]
_ids
is an array.
The error I was getting once implementing the answer was:
GraphQLError: Int cannot represent non-integer value: []
This was simply a GraphQL error, nothing to do with postgres.
The IN
operator expects either a set of rows with exactly one column, or a parenthesized list of scalar expressions. It doesn't accept an array.
One answer suggests :list
, which tells pg-promise to do the right thing:
WHERE _id IN ($1:list)
Another answer suggests = any
, where ANY
is a Postgres operator that does accept arrays:
WHERE _id = ANY ($1::int[])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With