root/sql/sprocs/noit.update_mns_via_self.sql

Revision f0400f824c10ceac576427c5023429506384cd8a, 464 bytes (checked in by Robert Treat <robert@omniti.com>, 4 years ago)

trigger function updates for metric name summary management

  • Property mode set to 100644
Line 
1 -- formerly stratcon.trig_update_tsvector_from_metric_summary
2
3 set search_path = noit, pg_catalog;
4
5 CREATE OR REPLACE FUNCTION update_mns_via_self()
6 RETURNS trigger AS
7 $BODY$
8 BEGIN
9 IF TG_OP = 'UPDATE' THEN
10     IF NEW.metric_name <> OLD.metric_name THEN
11         RETURN NEW;
12     END IF;
13 END IF;
14
15 NEW.fts_data = stratcon.metric_name_summary_compile_fts_data(NEW.sid, NEW.metric_name, NEW.metric_type);
16
17 RETURN new;
18 END
19 $BODY$
20 LANGUAGE 'plpgsql' 
21 SECURITY DEFINER;
22
Note: See TracBrowser for help on using the browser.