root/sql/sprocs/stratcon.init_metric_numeric_rollup.sql

Revision 66acead9783cbb25309f4bbf73e2fed9462863f3, 0.8 kB (checked in by Robert Treat <robert@omniti.com>, 4 years ago)

which is ironic

  • Property mode set to 100644
Line 
1 set search_path = noit, pg_catalog;
2
3 DROP TYPE IF EXISTS stratcon.metric_numeric_rollup CASCADE; 
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.