Show
Ignore:
Timestamp:
10/02/09 19:03:47 (5 years ago)
Author:
Denish Patel <denish@omniti.com>
git-committer:
Denish Patel <denish@omniti.com> 1254510227 +0000
git-parent:

[426d0fd8097a20882bfc6c83f302d4f034b35e15]

git-author:
Denish Patel <denish@omniti.com> 1254510227 +0000
Message:

Added noit.update_mns_via_self

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sql/sprocs/noit.update_mns_via_self.sql

    r426d0fd r4ff346a  
    11-- formerly stratcon.trig_update_tsvector_from_metric_summary 
     2CREATE OR REPLACE FUNCTION noit.update_mns_via_self() 
     3  RETURNS trigger AS 
     4$BODY$ 
     5DECLARE 
     6 BEGIN 
     7 IF TG_OP != 'INSERT' THEN 
     8   IF (NEW.metric_name <> OLD.metric_name) THEN 
     9           UPDATE noit.metric_name_summary SET ts_search_all=stratcon.metric_name_summary_tsvector(NEW.sid,NEW.metric_name,NEW.metric_type) 
     10             where sid=NEW.sid and metric_name=NEW.metric_name and metric_type = NEW.metric_type; 
     11   END IF;     
     12 ELSE  
     13    UPDATE noit.metric_name_summary SET ts_search_all=stratcon.metric_name_summary_tsvector(NEW.sid,NEW.metric_name,NEW.metric_type) 
     14            where sid=NEW.sid and metric_name=NEW.metric_name and metric_type = NEW.metric_type; 
     15 END IF;   
     16   RETURN NEW; 
     17END 
     18$BODY$ 
     19  LANGUAGE 'plpgsql'  SECURITY DEFINER; 
     20 
     21GRANT EXECUTE ON FUNCTION noit.update_mns_via_self() TO stratcon;