In the PostgreSQL, If you want to drop a function, you have to also mention the type of the parameters.
In this post, I am providing one script to populate DROP FUNCTION script with all the type of parameters.
One function definition is,
CREATE FUNCTION fn_test (id integer, name character varying);
You cannot drop this function using just DROP FUNCTION like,
DROP FUNCTION fn_test();
You have to also specify the type of the parameters like,
DROP FUNCTION fn_test(integer, character varying);
If we are going to drop multiple function, we require to prepare drop function script for each and every function by specifying the type of input parameters.
Here, I am sharing one script to solve this problem and using this script 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');
Please share your ideas and opinions about this topic with me, your contribution will add true value to this topic.
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.
If you like this post, then please share it with others.
Please follow dbrnd.com, I will share my experience towards the success of Database Research and Development Activity.
I put up a post every day, please keep reading and learning.
Discover Yourself, Happy Blogging !
Anvesh M. Patel.