Skip to content

Commit 9eb1e73

Browse files
committed
Don't DROP timescaledb_information VIEWS in migrations
update/downgrade scripts detach information views during ALTER EXTENSION so they must not be dropped to allow users to have references on them.
1 parent 3f5bca8 commit 9eb1e73

2 files changed

Lines changed: 0 additions & 12 deletions

File tree

sql/updates/latest-dev.sql

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ CREATE TABLE _timescaledb_internal.tmp_dimension_slice_seq_value AS
7272
ALTER TABLE _timescaledb_catalog.chunk_constraint
7373
DROP CONSTRAINT IF EXISTS chunk_constraint_dimension_slice_id_fkey;
7474

75-
DROP VIEW IF EXISTS timescaledb_information.chunks;
76-
7775
ALTER EXTENSION timescaledb DROP TABLE _timescaledb_catalog.dimension_slice;
7876
ALTER EXTENSION timescaledb DROP SEQUENCE _timescaledb_catalog.dimension_slice_id_seq;
7977

@@ -163,7 +161,6 @@ DROP FUNCTION _timescaledb_functions.chunk_constraint_add_table_constraint(
163161
_timescaledb_catalog.chunk_constraint);
164162
DROP FUNCTION IF EXISTS _timescaledb_internal.chunk_constraint_add_table_constraint(
165163
_timescaledb_catalog.chunk_constraint);
166-
DROP VIEW IF EXISTS timescaledb_information.chunks;
167164

168165
ALTER EXTENSION timescaledb DROP TABLE _timescaledb_catalog.chunk_constraint;
169166
ALTER EXTENSION timescaledb DROP SEQUENCE _timescaledb_catalog.chunk_constraint_name;
@@ -187,9 +184,6 @@ ALTER TABLE _timescaledb_catalog.hypertable
187184

188185
-- Drop views and foreign keys that depend on the catalog table.
189186
DROP VIEW IF EXISTS timescaledb_experimental.policies;
190-
DROP VIEW IF EXISTS timescaledb_information.hypertables;
191-
DROP VIEW IF EXISTS timescaledb_information.continuous_aggregates;
192-
DROP VIEW IF EXISTS timescaledb_information.jobs;
193187

194188
ALTER TABLE _timescaledb_catalog.continuous_aggs_watermark
195189
DROP CONSTRAINT continuous_aggs_watermark_mat_hypertable_id_fkey;

sql/updates/reverse-dev.sql

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ WHERE c.osm_chunk
4242
ON CONFLICT DO NOTHING;
4343

4444
-- Drop chunk stats related objects
45-
DROP VIEW IF EXISTS timescaledb_information.stat_chunk_activity;
4645
DROP FUNCTION IF EXISTS _timescaledb_functions.chunk_statistics(regclass, regclass, timestamptz);
4746
DROP FUNCTION IF EXISTS _timescaledb_functions.chunk_statistics_reset();
4847

@@ -91,8 +90,6 @@ CREATE TABLE _timescaledb_internal.tmp_dimension_slice AS
9190
CREATE TABLE _timescaledb_internal.tmp_dimension_slice_seq_value AS
9291
SELECT last_value, is_called FROM _timescaledb_catalog.dimension_slice_id_seq;
9392

94-
DROP VIEW IF EXISTS timescaledb_information.chunks;
95-
9693
ALTER EXTENSION timescaledb DROP TABLE _timescaledb_catalog.dimension_slice;
9794
ALTER EXTENSION timescaledb DROP SEQUENCE _timescaledb_catalog.dimension_slice_id_seq;
9895

@@ -193,9 +190,6 @@ DROP FUNCTION IF EXISTS _timescaledb_functions.rebuild_sparse_index(REGCLASS, BO
193190
-- Rebuild the catalog table `_timescaledb_catalog.continuous_agg` to drop the
194191
-- `schema_change_timestamp` column.
195192
DROP VIEW IF EXISTS timescaledb_experimental.policies;
196-
DROP VIEW IF EXISTS timescaledb_information.hypertables;
197-
DROP VIEW IF EXISTS timescaledb_information.continuous_aggregates;
198-
DROP VIEW IF EXISTS timescaledb_information.jobs;
199193

200194
ALTER TABLE _timescaledb_catalog.continuous_aggs_watermark
201195
DROP CONSTRAINT continuous_aggs_watermark_mat_hypertable_id_fkey;

0 commit comments

Comments
 (0)