This article is half-done without your Comment! *** Please share your thoughts via Comment ***
In the PostgreSQL, If you want to drop a function, you also have to mention the type of the parameters.
In this post, I am providing a script which populates DROP FUNCTION script with all the type of parameters.
One function definition is:
1 CREATE FUNCTION fn_test (id integer, name character varying);
You cannot drop this function using just DROP FUNCTION like:
1 DROP FUNCTION fn_test();
You have to also specify the type of the parameters like:
1 DROP FUNCTION fn_test(integer, character varying);
If we are going to drop multiple functions, we need a script for dropping all functions by specifying their relevant type of parameters.
Below is a script to solve this problem and using it you can get a full DROP FUNCTION script with the type of input parameters. You can select the require drop function script and execute it.
SELECT FORMAT('DROP FUNCTION %s(%s);'
FROM pg_proc AS p
INNER JOIN pg_namespace AS n
ON p.pronamespace = n.oid
WHERE n.nspname NOT IN ('pg_catalog', 'information_schema');