Skip to content

Commit

Permalink
Add fixed trigger drop_partition_on_delete_service to upgrade script
Browse files Browse the repository at this point in the history
The trigger is called `BEFORE DELETE` and was always returning `NULL`, canceling the actual `DELETE` statement.
  • Loading branch information
ioguix committed Apr 13, 2022
1 parent 60e39e3 commit 6c3f0d4
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions pg/wh_nagios--2.5--2.6.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@
--
-- Copyright (C) 2012-2022: Open PostgreSQL Monitoring Development Group

CREATE OR REPLACE
FUNCTION wh_nagios.drop_partition_on_delete_service()
RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
EXECUTE format('DROP TABLE wh_nagios.service_counters_%s', OLD.id) ;
RETURN OLD;
EXCEPTION
WHEN undefined_table THEN
RETURN NULL;
END
$$;

/* wh_nagios.delete_metrics(VARIADIC bigint[])
Delete specific metrics.
Expand Down

0 comments on commit 6c3f0d4

Please sign in to comment.