diff --git a/files/grest/rpc/db-scripts/basics.sql b/files/grest/rpc/db-scripts/basics.sql index 8cd57625..8c3ebb9e 100644 --- a/files/grest/rpc/db-scripts/basics.sql +++ b/files/grest/rpc/db-scripts/basics.sql @@ -116,9 +116,17 @@ END $do$; -- DROP EXISTING GREST ADDED TRIGGERS ON PUBLIC SCHEMA -FOR r IN (SELECT trigger_name, event_object_table FROM information_schema.triggers WHERE trigger_schema = 'public' AND action_statement LIKE '%grest.%') LOOP - EXECUTE 'DROP TRIGGER IF EXISTS ' || quote_ident(r.trigger_name) || ' ON ' || quote_ident(r.event_object_table); -END LOOP; +DO +$$ +DECLARE + r record; +BEGIN + FOR r IN (SELECT trigger_name, event_object_table FROM information_schema.triggers WHERE trigger_schema = 'public' AND action_statement LIKE '%grest.%') + LOOP + EXECUTE 'DROP TRIGGER IF EXISTS ' || quote_ident(r.trigger_name) || ' ON ' || quote_ident(r.event_object_table); + END LOOP; +END +$$; -- HELPER FUNCTIONS -- CREATE FUNCTION grest.get_query_pids_partial_match(_query text)