tww
.tww_app
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
alter_modification_triggers(action_name text)
Parameters
Name
Type
Mode
action_name
text
IN
Definition
DECLARE schdf text; tbldf text; trig text; BEGIN IF NOT (action_name ILIKE ANY(ARRAY['ENABLE','DISABLE'])) THEN RAISE NOTICE '% not a valid input',action_name; RETURN; ELSE FOR schdf,tbldf, trig IN SELECT c.relnamespace ::regnamespace::text, c.relname, t.tgname FROM pg_trigger t INNER JOIN pg_class c on t.tgrelid=c.oid INNER JOIN pg_proc p on t.tgfoid=p.oid WHERE p.proname LIKE 'modification_%' AND p.pronamespace::regnamespace::text = 'tww_app' LOOP EXECUTE FORMAT('ALTER TABLE %I.%I %s TRIGGER %I',schdf,tbldf,upper(action_name),trig); END LOOP; RETURN; END IF; END;