我有这个功能:
create or replace function insert_aereo( aereo_type[] ) returns text as $$
begin
return 'ok';
end
$$ language plpgsql;
这是我创建的参数类型:
create type aereo_type as (codice int, modello varchar, marca varchar);
然后我调用我的函数:
select insert_aereo('{123, "ciao", "pippo"}');
但是我收到了这个错误:
ERROR: function insert_aereo(unknown) is not unique at character 8 HINT: Could not choose a best candidate function. You might need to add explicit type casts. STATEMENT: select insert_aereo('{123, "ciao", "pippo"}'); ERROR: function insert_aereo(unknown) is not unique LINE 1: select insert_aereo('{123, "ciao", "pippo"}'); ^ HINT: Could not choose a best candidate function. You might need to add explicit type casts.
我该如何解决?我做错了什么?
答案 0 :(得分:1)
您使用的是合格类型的错误格式:
正确的格式是:
'{“(123,ciao,pippo)”,“(...)”}
请参阅:http://www.postgresql.org/docs/8.4/interactive/rowtypes.html
或ARRAY [(1,'ciao','pippo')] :: t []
的Pavel