Created
April 13, 2016 19:33
-
-
Save talos/8aba5211a9e593c2e64eddd3524139ed to your computer and use it in GitHub Desktop.
kill_obs_functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION kill_obs_functions( | |
) RETURNS void | |
AS $$ | |
DECLARE | |
killselect TEXT; | |
BEGIN | |
FOR killselect in SELECT 'DROP FUNCTION ' || ns.nspname || '.' || proname || '(' || | |
oidvectortypes(proargtypes) || ');' | |
FROM pg_proc | |
JOIN pg_namespace ns ON (pg_proc.pronamespace = ns.oid) | |
WHERE proname ilike 'obs_%' order by proname | |
LOOP | |
raise notice '%', killselect; | |
EXECUTE killselect; | |
END LOOP; | |
END; | |
$$ language plpgsql; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment