Hi
If i replace function parameters of existent function and then try to drop it, dbeave returns "function does not exist".
Can you provide more detail, maybe a screenshot of the error message or the code you're working on? I'll take a shot at giving some insight, but I might not be understanding your issue.
In Postgres, each function name and its argument types are what actually define the function. So if you changed the parameter types, then you created a new function, and would have to drop both of them. In the example provided below, I've created two functions, both called add_two, however they are different functions even though they share the same name. Due to this, when I execute DROP FUNCTION, I have to explicitly state the argument data types.
I could have created a function called add_two() without any arguments, and then executing DROP FUNCTION add_two(); would work, but it would only drop the function without arguments.
CREATE FUNCTION add_two(a int, b int)
RETURNS int
AS $$
BEGIN
return a+b;
END;
$$
LANGUAGE plpgsql
SELECT add_two(1, 2);
-- output: 3
CREATE FUNCTION add_two(a int, b double precision)
RETURNS double precision
AS $$
BEGIN
return a+b;
END;
$$
LANGUAGE plpgsql
SELECT add_two(1, 2.5);
-- output: 3.5
DROP FUNCTION add_two;
-- syntax error
DROP FUNCTION add_two();
-- returns error: function add_two() does not exist
DROP FUNCTION add_two(int, int);
-- drops first declaration of function
DROP FUNCTION add_two(int, double precision);
-- drops second declaration of function
Most helpful comment
Can you provide more detail, maybe a screenshot of the error message or the code you're working on? I'll take a shot at giving some insight, but I might not be understanding your issue.
In Postgres, each function name and its argument types are what actually define the function. So if you changed the parameter types, then you created a new function, and would have to drop both of them. In the example provided below, I've created two functions, both called add_two, however they are different functions even though they share the same name. Due to this, when I execute
DROP FUNCTION, I have to explicitly state the argument data types.I could have created a function called add_two() without any arguments, and then executing
DROP FUNCTION add_two();would work, but it would only drop the function without arguments.