Skip to content

Instantly share code, notes, and snippets.

@talos
Created April 13, 2016 19:33
Show Gist options
  • Save talos/8aba5211a9e593c2e64eddd3524139ed to your computer and use it in GitHub Desktop.
Save talos/8aba5211a9e593c2e64eddd3524139ed to your computer and use it in GitHub Desktop.
kill_obs_functions
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