没有匹配的函数,可能需要添加显式类型转换
代码中的以下语句让我遇到了一个错误:
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 个回答
1
错误信息显示:
psycopg2.ProgrammingError: 函数 agg_bit_or(integer[]) 不存在
而你的聚合函数是这样定义的:
CREATE AGGREGATE agg_bit_or(bit[])
我强调的部分。你需要确保使用的类型是兼容的。