diff options
author | yvesf <yvesf-git@xapek.org> | 2011-07-17 15:25:02 +0200 |
---|---|---|
committer | yvesf <yvesf-git@xapek.org> | 2011-07-17 15:25:02 +0200 |
commit | cb60101a35df0a462fc54dac56a93353b1359c3b (patch) | |
tree | 7d812cb054413611b0f2d166d34fff5cd9274802 | |
parent | ba14c390b1f377bed6b46a83073bc35e0438b88e (diff) | |
download | ebus-alt-cb60101a35df0a462fc54dac56a93353b1359c3b.tar.gz ebus-alt-cb60101a35df0a462fc54dac56a93353b1359c3b.zip |
korrigiere populate_cache.sql
-rw-r--r-- | populate_cache.sql | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/populate_cache.sql b/populate_cache.sql index 0c30a18..f13fa85 100644 --- a/populate_cache.sql +++ b/populate_cache.sql @@ -10,7 +10,7 @@ create or replace view vi_value_cache as SELECT timestamp, sensor_id, value_real, 'CACHE' FROM value_cache UNION - SELECT date_trunc('hour', timestamp), sensor_id, COALESCE(avg(value_int),avg(value_real)), 'LIVE' + SELECT date_trunc('hour', timestamp), sensor_id, COALESCE(avg(value_int),avg(value_float)), 'LIVE' FROM value WHERE date_trunc('hour', timestamp) > coalesce((select max(timestamp) from value_cache), now() - interval '2 days') @@ -35,7 +35,7 @@ BEGIN delete from value_cache where timestamp >= last_update; insert into value_cache - select COALESCE(avg(value_real),avg(value_int)), date_trunc('hour', timestamp), sensor_id + select COALESCE(avg(value_float),avg(value_int)), date_trunc('hour', timestamp), sensor_id from value where date_trunc('hour', timestamp) > last_update group by date_trunc('hour', timestamp), sensor_id; |