Changeset 5de3ee066898c7932e978dbe8224ca4e280635cb
- Timestamp:
- 05/14/08 00:54:13
(5 years ago)
- Author:
- Theo Schlossnagle <jesus@omniti.com>
- git-committer:
- Theo Schlossnagle <jesus@omniti.com> 1210726453 +0000
- git-parent:
[143a7f5401614fa0dcc032e7a584d559ac74def5]
- git-author:
- Theo Schlossnagle <jesus@omniti.com> 1210726453 +0000
- Message:
fix the triggers.. the row itself is called nam, the summary is metric_name. Also, move the if not found's in the windowed functions to be immediately after window selection
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r143a7f5 |
r5de3ee0 |
|
| 266 | 266 | END IF; |
|---|
| 267 | 267 | |
|---|
| 268 | | SELECT sid,metric_name FROM stratcon.metric_name_summary WHERE sid=NEW.sid and metric_name=NEW.metric_name |
|---|
| | 268 | SELECT sid,metric_name FROM stratcon.metric_name_summary WHERE sid=NEW.sid and metric_name=NEW.name |
|---|
| 269 | 269 | INTO v_sid,v_name; |
|---|
| 270 | 270 | IF NOT FOUND THEN |
|---|
| 271 | | INSERT INTO stratcon.metric_name_summary(sid,metric_name,metric_type) VALUES(NEW.sid,NEW.metric_name,'text'); |
|---|
| | 271 | INSERT INTO stratcon.metric_name_summary(sid,metric_name,metric_type) VALUES(NEW.sid,NEW.name,'text'); |
|---|
| 272 | 272 | END IF; |
|---|
| 273 | 273 | |
|---|
| … | … | |
| 299 | 299 | END IF; |
|---|
| 300 | 300 | |
|---|
| 301 | | SELECT sid,metric_name FROM stratcon.metric_name_summary WHERE sid=NEW.sid and metric_name=NEW.metric_name |
|---|
| | 301 | SELECT sid,metric_name FROM stratcon.metric_name_summary WHERE sid=NEW.sid and metric_name=NEW.name |
|---|
| 302 | 302 | INTO v_sid,v_name; |
|---|
| 303 | 303 | IF NOT FOUND THEN |
|---|
| 304 | | INSERT INTO stratcon.metric_name_summary VALUES(NEW.sid,NEW.metric_name,'numeric'); |
|---|
| | 304 | INSERT INTO stratcon.metric_name_summary VALUES(NEW.sid,NEW.name,'numeric'); |
|---|
| 305 | 305 | END IF; |
|---|
| 306 | 306 | |
|---|
| … | … | |
| 961 | 961 | select * into v_target from stratcon.choose_window(in_start_time, in_end_time, in_hopeful_nperiods); |
|---|
| 962 | 962 | |
|---|
| | 963 | if not found then |
|---|
| | 964 | raise exception 'no target table'; |
|---|
| | 965 | return; |
|---|
| | 966 | end if; |
|---|
| | 967 | |
|---|
| 963 | 968 | select 'epoch'::timestamp + |
|---|
| 964 | 969 | ((floor(extract('epoch' from in_start_time) / |
|---|
| … | … | |
| 972 | 977 | extract('epoch' from v_target.period)) || ' seconds') ::interval |
|---|
| 973 | 978 | into v_end_adj; |
|---|
| 974 | | |
|---|
| 975 | | if not found then |
|---|
| 976 | | raise exception 'no target table'; |
|---|
| 977 | | return; |
|---|
| 978 | | end if; |
|---|
| 979 | 979 | |
|---|
| 980 | 980 | v_sql := 'select ' || v_sid || ' as sid, ' || quote_literal(in_name) || ' as name, ' || |
|---|