rrs-commit: r43 - trunk/update/0.3-0.4

decibel at decibel.org decibel at decibel.org
Mon Mar 21 02:03:44 GMT 2005


Author: decibel
Date: Mon Mar 21 02:03:43 2005
New Revision: 43

Modified:
   trunk/update/0.3-0.4/rrs.sql
Log:
Add view creation to update script

Modified: trunk/update/0.3-0.4/rrs.sql
==============================================================================
--- trunk/update/0.3-0.4/rrs.sql	(original)
+++ trunk/update/0.3-0.4/rrs.sql	Mon Mar 21 02:03:43 2005
@@ -7,6 +7,26 @@
 
 BEGIN;
 
+CREATE OR REPLACE VIEW rrs.history_data_interval_run_time_v AS
+    SELECT h.*
+            , CASE WHEN run_time_sec > 0
+                THEN rrs.seconds_to_interval(
+                        rrs.interval_to_seconds(data_interval)
+                        * desired_run_time_sec
+                        / run_time_sec
+                    )
+                END AS next_data_interval
+        FROM
+            ( SELECT rrs.interval_to_seconds(
+                                rrs.setting_get('desired run time')::interval
+                        ) AS desired_run_time_sec
+            ) AS s
+            , ( SELECT start_time, end_time, data_interval
+                        , end_time - start_time AS run_time
+                        , rrs.interval_to_seconds( end_time - start_time ) AS run_time_sec
+                    FROM history_data_interval ) h
+;
+
 CREATE TABLE version (
     component   text    NOT NULL CONSTRAINT version__component PRIMARY KEY
     , version     text    NOT NULL


More information about the rrs-commit mailing list