请帮助我,为什么我得到的错误功能不存在?
[2018-10-31 12:31:05] [42883]错误:函数companytester(bigint,未知,未知,未知,未知)不存在
提示:没有函数与给定的名称和参数类型匹配。您可能需要添加显式类型转换。
CREATE OR REPLACE FUNCTION companyTester(founder Founder) RETURNS BOOLEAN AS $$
BEGIN
RAISE NOTICE 'Founder id: %',founder.founder_id;
RAISE NOTICE 'Founder FirstName: %',founder.firstname;
RAISE NOTICE 'Founder LastName: %',founder.lastname;
RAISE NOTICE 'Founder email: %',founder.email;
RAISE NOTICE 'Founder password %',founder.f_password;
END;
$$ LANGUAGE plpgsql;
SELECT companyTester(76565445354,'Maks','Burkov','Maks.Burkov88@gmail.com','+_@Maks88;
CREATE TYPE Founder AS (
founder_id BIGINT,
firstname VARCHAR(150),
lastname VARCHAR(150),
email VARCHAR(50),
f_password VARCHAR(50)
);
答案 0 :(得分:1)
您正在向该函数传递5个参数,但声明该参数仅接受一个参数(类型为founder
)
您需要一个row constructor来创建founder
的适当实例,从而仅传递一个参数:
SELECT companyTester(
(76565445354,'Maks','Burkov','Maks.Burkov88@gmail.com','+_@Maks88')::founder
);
表达式(76565445354,'Maks','Burkov','Maks.Burkov88@gmail.com','+_@Maks88')::founder
是单个值
或者,您可以使用:
SELECT companyTester(row(76565445354,'Maks','Burkov','Maks.Burkov88@gmail.com','+_@Maks88'));