-- -- trigger_func_exists/1 -- create or replace function trigger_func_exists( character varying ) returns bool as $$ declare trigger_name alias for $1; begin return count(*) = 1 from pg_proc where proname = lower(trigger_name) and pronargs = 0; end;$$ language plpgsql;