当前位置: 首页 > 知识库问答 >
问题:

没有与给定的名称和参数类型匹配的函数,您可能需要添加显式类型强制转换

邓阳炎
2023-03-14

代码中的以下语句给了我一个错误:

cur.execute("
   update %s as A
   set fm = foo.fm
   from (
      select src_id as id, agg_bit_or(fm) as fm
      from %s, %s where dst_id = id
      group by src_id) as foo
   where A.id = foo.id" %(tmp_table, edge_table, vertex_table))

agg_bit_or()是Postgres中的用户定义聚合函数,定义为:

CREATE AGGREGATE agg_bit_or(bit[])
(
    sfunc = bit_or,
    stype = bit[]   
);

错误消息为:

File "radius.py", line 47, in update_bitstring
cur.execute("update %s as A set fm = foo.fm from (select src_id as id, agg_b
it_or(fm)  from %s, %s where dst_id = id group by src_id) as foo where A.id = fo
o.id" %(tmp_table, edge_table, vertex_table))

psycopg2.ProgrammingError: function agg_bit_or(integer[]) does not exist
LINE 1: ...v as A set fm = foo.fm from (select src_id as id, agg_bit_or...
                                                         ^
HINT:  No function matches the given name and argument types. You might need to
add explicit type casts.

共有1个答案

沈凡
2023-03-14

错误消息显示:

psycopg2.programmingerror:函数agg_bit_or(integer[])不存在

定义聚合函数时:

 类似资料: