root/sql/sprocs/stratcon.init_metric_numeric_rollup.sql

Revision 7e9875572080d3b788f8e35c2d9a18e685c884f3, 0.7 kB (checked in by Robert Treat <robert@omniti.com>, 4 years ago)

somebody wants this to be right

  • Property mode set to 100644
Line 
1 set search_path = noit, pg_catalog;
2
3 DROP TYPE IF EXIST stratcon.metric_numeric_rollup; 
4 CREATE TYPE stratcon.metric_numeric_rollup AS (sid integer,  name text, rollup_time timestamp with time zone, count_rows integer[], avg_value numeric[], counter_dev numeric[]); 
5
6 CREATE OR REPLACE FUNCTION stratcon.init_metric_numeric_rollup(in_rollup text)
7 RETURNS SETOF stratcon.metric_numeric_rollup
8 AS $$
9   SELECT null::int, null::text, null::timestamptz, array_agg(count_rows), array_agg(avg_value), array_agg(counter_dev) from (select NULL::int as count_rows, NULL::numeric as avg_value, NULL::numeric as counter_dev from generate_series(1,(select span/seconds from metric_numeric_rollup_config where rollup = $1))) x;
10 $$
11 LANGUAGE 'sql'
12 SECURITY DEFINER
13 ;
14
15
Note: See TracBrowser for help on using the browser.