1-- This file and its contents are licensed under the Apache License 2.0. 2-- Please see the included NOTICE for copyright information and 3-- LICENSE-APACHE for a copy of the license. 4 5-- When running a downgrade tests, the extension is first updated to 6-- the later version and then downgraded to the previous version. This 7-- means that in some cases, changes done by the update is not 8-- reversed by the downgrade. If these changes are harmless, we can 9-- apply changes to the clean rerun to incorporate these changes 10-- directly and prevent a diff between the clean-rerun version and the 11-- upgrade-downgrade version of the database. 12 13SELECT extversion >= '2.0.0' AS has_create_mat_view 14 FROM pg_extension 15 WHERE extname = 'timescaledb' \gset 16 17-- Rebuild the user views based on the renamed views 18\if :has_create_mat_view 19ALTER MATERIALIZED VIEW rename_cols SET (timescaledb.materialized_only = FALSE); 20\else 21ALTER VIEW rename_cols SET (timescaledb.materialized_only = FALSE); 22\endif 23