PostgreSQL数组\u在BIGINT数组上删除

PostgreSQL数组\u在BIGINT数组上删除,postgresql,Postgresql,我试图从BIGINT数组中删除一个项,因此我自然尝试: update MyTABLE set MyBigIntArray= array_remove(MyBigIntArray,1) where id=10 但是Postgresql(尝试了9.5和10.0)回答我: 提示:没有与给定名称和参数类型匹配的函数。你 可能需要添加显式类型转换。错误:函数 数组_remove(bigint[],integer)不存在 即使它通常接受anyarray:array\u remove(anyarray,an

我试图从BIGINT数组中删除一个项,因此我自然尝试:

update MyTABLE
set MyBigIntArray= array_remove(MyBigIntArray,1)
where id=10
但是Postgresql(尝试了9.5和10.0)回答我:

提示:没有与给定名称和参数类型匹配的函数。你 可能需要添加显式类型转换。错误:函数 数组_remove(bigint[],integer)不存在

即使它通常接受anyarray:array\u remove(anyarray,anyelement) ,src:

唯一能让它工作的是像这样将我的bigint[]转换为int[]:

update MyTABLE
set MyBigIntArray= array_remove(MyBigIntArray::int[],1)
where id=10

那么,有没有一种简单的方法可以做到这一点?(我找到了一些plsql/SQL函数)

您还需要将
1
转换为
bigint

[local] #= SELECT array_remove(ARRAY[1::bigint], 1);
ERROR:  42883: function array_remove(bigint[], integer) does not exist
LINE 1: SELECT array_remove(ARRAY[1::bigint], 1);
               ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
LOCATION:  ParseFuncOrColumn, parse_func.c:523


谢谢,该死,太简单了:)
[local] #= SELECT array_remove(ARRAY[1::bigint], 1::bigint);
┌──────────────┐
│ array_remove │
├──────────────┤
│ {}           │
└──────────────┘
(1 row)