PG-承诺 - 错误操作者不存在:BIGINT = BIGINT []

问题描述 投票:1回答:1

我试图运行查询:

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是一个数组。

NOTE

错误我得到一次执行得到的答案是:

GraphQLError: Int cannot represent non-integer value: []

这是一个简单的GraphQL错误,无关的Postgres。

javascript node.js postgresql pg-promise
1个回答
2
投票

IN运营商期望无论是set of rows with exactly one columnparenthesized list of scalar expressions。它不接受一个数组。

One answer建议:list,它告诉PG-承诺做正确的事情:

WHERE _id IN ($1:list)

Another answer建议= any,其中ANY是不会接受一个数组Postgres operator

WHERE _id = ANY ($1::int[])
© www.soinside.com 2019 - 2024. All rights reserved.