Changeset c1fcb76822fc1aa6b47a9999834cab6c2abeba47

Show
Ignore:
Timestamp:
05/12/08 16:10:25 (6 years ago)
Author:
Denish Patel <denish@omniti.com>
git-committer:
Denish Patel <denish@omniti.com> 1210608625 +0000
git-parent:

[87e2e42dc13b0cfe0cfafcbc70430174c89a04a1]

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

Added metric_name_summary table and updated functions to insert rows to summary table.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sql/schema.sql

    r87e2e42 rc1fcb76  
    133133); 
    134134 
     135CREATE TABLE stratcon.metric_name_summary ( 
     136  sid integer NOT NULL, 
     137  name text NOT NULL, 
     138  type character varying(22), 
     139  active boolean default 'true', 
     140  PRIMARY KEY (sid,name) 
     141); 
    135142-- Schema Sequence  
    136143 
     
    160167 GRANT SELECT,INSERT ON stratcon.map_uuid_to_sid TO stratcon; 
    161168 GRANT SELECT,INSERT,UPDATE,DELETE ON stratcon.rollup_runner TO stratcon; 
     169 GRANT SELECT,INSERT,UPDATE,DELETE ON stratcon.metric_name_summary TO stratcon; 
    162170 ALTER TABLE stratcon.seq_sid OWNER TO stratcon; 
    163171  
     
    242250DECLARE 
    243251    v_oldvalue TEXT; 
     252    v_sid integer; 
     253    v_name text; 
    244254BEGIN 
    245255 
     
    254264        INSERT INTO stratcon.loading_dock_metric_text_s_change_log (sid,whence,name,value) 
    255265            VALUES (NEW.sid, NEW.whence, NEW.name, NEW.value);  
    256  
     266    END IF; 
     267     
     268    SELECT sid,name FROM stratcon.metric_name_summary WHERE sid=NEW.sid  and name=NEW.name 
     269         INTO v_sid,v_name; 
     270       IF NOT FOUND THEN 
     271           INSERT INTO  stratcon.metric_name_summary VALUES(NEW.sid,NEW.name,'text'); 
    257272    END IF; 
    258273 
     
    274289DECLARE 
    275290v_whence timestamptz; 
     291v_sid integer; 
     292v_name text; 
    276293BEGIN 
    277294IF TG_OP = 'INSERT' THEN 
     
    281298       INSERT INTO  stratcon.log_whence_s VALUES(date_trunc('H',NEW.WHENCE) + (round(extract('minute' from NEW.WHENCE)/5)*5) * '1 minute'::interval,'5 minutes'); 
    282299    END IF; 
     300 
     301   SELECT sid,name FROM stratcon.metric_name_summary WHERE sid=NEW.sid  and name=NEW.name 
     302     INTO v_sid,v_name; 
     303   IF NOT FOUND THEN 
     304       INSERT INTO  stratcon.metric_name_summary VALUES(NEW.sid,NEW.name,'numeric'); 
     305    END IF; 
     306 
    283307END IF; 
    284308