timescaledb/sql/updates/post-update.sql
gayyappan ed64af76a5 Fix real time aggregate support for multiple aggregates
We should compute the watermark using the materialization
hypertable id and not by using the raw hypertable id.
New test cases added to continuous_aggs_multi.sql. Existing test
cases in continuous_aggs_multi.sql were not correctly updated
for this feature.

Fixes #1865
2020-05-15 10:15:53 -04:00

19 lines
641 B
SQL

-- needed post 1.7.0 to fixup continuous aggregates created in 1.7.0 ---
DO $$
<<ts_realtime_agg_update>>
DECLARE
vname regclass;
altercmd text;
BEGIN
FOR vname IN select view_name from timescaledb_information.continuous_aggregates where materialized_only = false
LOOP
-- the cast from oid to text returns quote_qualified_identifier
-- (see regclassout)
altercmd := format('ALTER VIEW %s SET (timescaledb.materialized_only=false) ', vname::text) ;
RAISE INFO 'cmd executed: %', altercmd;
EXECUTE altercmd;
END LOOP;
EXCEPTION WHEN OTHERS THEN RAISE;
END ts_realtime_agg_update $$;