Remove use of REGCLASS in views

Removing usage of `REGCLASS` from view `continuous_aggregates` and
splitting it into schema and name.
This commit is contained in:
Mats Kindahl 2020-10-05 11:38:10 +02:00 committed by Mats Kindahl
parent 7a406fa690
commit c029a7be02
4 changed files with 6 additions and 3 deletions

View File

@ -89,7 +89,9 @@ FROM _timescaledb_config.bgw_job j
-- views for continuous aggregate queries ---
CREATE OR REPLACE VIEW timescaledb_information.continuous_aggregates as
SELECT format('%1$I.%2$I', cagg.user_view_schema, cagg.user_view_name)::regclass as view_name,
SELECT
cagg.user_view_schema AS view_schema,
cagg.user_view_name AS view_name,
viewinfo.viewowner as view_owner,
bgwjob.schedule_interval,
cagg.materialized_only,

View File

@ -67,7 +67,7 @@ CALL refresh_continuous_aggregate(' mat_refresh_test', NULL, NULL);
SELECT id as cagg_job_id FROM _timescaledb_config.bgw_job order by id desc limit 1 \gset
SELECT format('%I.%I', materialization_hypertable_schema, materialization_hypertable_name ) as materialization_hypertable
FROM timescaledb_information.continuous_aggregates
WHERE view_name = 'mat_refresh_test'::regclass \gset
WHERE view_name = 'mat_refresh_test' \gset
SELECT mat_hypertable_id FROM _timescaledb_catalog.continuous_agg WHERE user_view_name = 'mat_refresh_test' \gset
SELECT schema_name as mat_chunk_schema, table_name as mat_chunk_table
FROM _timescaledb_catalog.chunk

View File

@ -70,6 +70,7 @@ SELECT * FROM device_summary WHERE metric_spread = 1800 ORDER BY bucket DESC, de
\x
SELECT * FROM timescaledb_information.continuous_aggregates;
-[ RECORD 1 ]---------------------+-------------------------------------------------------------------------------------------------------------
view_schema | public
view_name | device_summary
view_owner | default_perm_user
schedule_interval | @ 2 hours

View File

@ -64,7 +64,7 @@ CALL refresh_continuous_aggregate(' mat_refresh_test', NULL, NULL);
SELECT id as cagg_job_id FROM _timescaledb_config.bgw_job order by id desc limit 1 \gset
SELECT format('%I.%I', materialization_hypertable_schema, materialization_hypertable_name ) as materialization_hypertable
FROM timescaledb_information.continuous_aggregates
WHERE view_name = 'mat_refresh_test'::regclass \gset
WHERE view_name = 'mat_refresh_test' \gset
SELECT mat_hypertable_id FROM _timescaledb_catalog.continuous_agg WHERE user_view_name = 'mat_refresh_test' \gset