我试图运行查询:
let query =
`
DELETE FROM
${table_name}
WHERE
_id IN ($1::bigint[])
AND
account_id = $2
`
let fields =
[
_ids,
account_id,
]
但它给我的错误:
operator does not exist: bigint = bigint[]
_ids
是一个数组。
错误我得到一次执行得到的答案是:
GraphQLError: Int cannot represent non-integer value: []
这是一个简单的GraphQL错误,无关的Postgres。
该IN
运营商期望无论是set of rows with exactly one column或parenthesized list of scalar expressions。它不接受一个数组。
One answer建议:list
,它告诉PG-承诺做正确的事情:
WHERE _id IN ($1:list)
Another answer建议= any
,其中ANY
是不会接受一个数组Postgres operator:
WHERE _id = ANY ($1::int[])