I'm trying to write a command that will delete all functions in a namespace. I've already found a command that will generate the drop functions script:
SELECT 'DROP FUNCTION ' || ns.nspname || '.' || proname || '('
|| oidvectortypes(proargtypes) || ');'
FROM pg_proc INNER JOIN pg_namespace ns ON (pg_proc.pronamespace = ns.oid)
WHERE ns.nspname = 'public' order by proname;
Source: http://www.postgresonline.com/journal/archives/74-How-to-delete-many-functions.html
This will generate something like:
?column?
------------------------------------------
DROP FUNCTION public.function1(bigint);
DROP FUNCTION public.function2();
DROP FUNCTION public.function3(text);
However, I can't figure out how to change the code, so that the functions are actually deleted - as opposed to only generating the commands.
Any ideas?