我有一个表格,其列号为bigint类型。我需要创建一个参数bigint []的函数,在函数中我应该检查(数组)中的id
CREATE OR REPLACE FUNCTION my_function(ids bigint[])
select * from table where id in ($1)
功能创建成功,但是当我调用它时
SELECT * FROM my_function(ARRAY [1,2,3,4]);
我收到错误:
ERROR: operator does not exist: bigint = bigint[]
答案 0 :(得分:1)
评论如下:
where id = any ($1)
https://www.postgresql.org/docs/current/static/functions-comparisons.html#AEN21104