问题
I try to get this function running. When I use pgadmin and manually call this function with
SELECT calculate_something(7) or SELECT common.calculate_something(7)
ERROR: function calculate_something(integer) doesn't exist
hint no function matches the given name and argument types
(translated from german)
I already tried to cast the call 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;
回答1:
Is your function actually called:
stoff_stueckgewicht(id bigint)
Or perhaps:
stoff_stückgewicht(id bigint)
?
The latter is a likely cause of problems if your locale settings are different between debian and PostgreSQL.
Alternatively, go through all the functions in all of the schemas on your database, using pgAdmin III and find the function manually.
回答2:
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)
And check your search_path:
- How does the search_path influence identifier resolution and the "current schema"
Either way, a bigint function can be called with a numeric literal - defaulting to integer, but there is a registered cast to bigint.
Consider Function Type Resolution:
- PostgreSQL function call
- Is there a way to disable function overloading in Postgres
来源:https://stackoverflow.com/questions/36126429/error-no-function-matches-the-given-name-and-argument-types