问题描述
我尝试使此功能运行.当我使用pgadmin并使用
I try to get this function running. When I use pgadmin and manually call this function with
SELECT calculate_something(7)
或SELECT common.calculate_something(7)
ERROR: function calculate_something(integer) doesn't existhint no function matches the given name and argument types
(从德语翻译)
ERROR: function calculate_something(integer) doesn't existhint no function matches the given name and argument types
(translated from german)
我已经尝试过呼叫SELECT calculate_something(cast(7 as bigint));
该函数或演员表出了什么问题? :/
What is wrong with that function or cast? :/
CREATE OR REPLACE FUNCTION common.calculate_something(id bigint)
RETURNS real AS
$BODY$
DECLARE
some_value_out REAL := 20;
BEGIN
-- I already removed that part for bug fixing and return a constant value (20)
RETURN some_value_out;
END;
$BODY$
LANGUAGE plpgsql VOLATILE;
推荐答案
使用它来诊断您的问题:
Use this to diagnose your problem:
SELECT n.nspname AS schema, p.proname AS function
, pg_get_function_identity_arguments(p.oid) As args
FROM pg_proc p
JOIN pg_namespace n ON n.oid = p.pronamespace
WHERE p.proname LIKE 'calculate%';
- 如何获取函数参数列表(以便删除函数)
- How to get function parameter lists (so I can drop a function)
- PostgreSQL function call
- Is there a way to disable function overloading in Postgres
并检查您的search_path
:
无论哪种方式,都可以使用数字文字来调用bigint
函数 -默认为integer
,但是有注册的强制转换为bigint
.
Either way, a bigint
function can be called with a numeric literal - defaulting to integer
, but there is a registered cast to bigint
.
考虑函数类型解析:
这篇关于错误:没有函数与给定的名称和参数类型匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!