-- -- drop_package/1 -- create or replace function drop_package( package_name character varying ) returns varchar as $$ DECLARE v_rec record; v_drop_cmd varchar; v_pkg_name varchar; BEGIN raise NOTICE 'DROP PACKAGE: %', package_name; v_pkg_name := package_name || '__' || '%'; for v_rec in select proname from pg_proc where proname like v_pkg_name order by proname LOOP raise NOTICE 'DROPPING FUNCTION: %', v_rec.proname; v_drop_cmd := get_func_drop_command (v_rec.proname::varchar); EXECUTE v_drop_cmd; DELETE FROM acs_function_args where function = upper(v_rec.proname); end loop; if NOT FOUND then raise NOTICE 'PACKAGE: % NOT FOUND', package_name; else raise NOTICE 'PACKAGE: %: DROPPED', package_name; end if; return null; END; $$ language plpgsql;