Skip to content

Commit 9cb1eec

Browse files
committed
Add compatibility view for chunk_constraint
1 parent 61678e2 commit 9cb1eec

6 files changed

Lines changed: 23 additions & 6 deletions

File tree

cmake/ScriptFiles.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ set(SOURCE_FILES
4444
uuidv7.sql
4545
ts_stats.sql
4646
views.sql
47+
views_compat.sql
4748
views_experimental.sql
4849
gapfill.sql
4950
compression.sql

sql/updates/latest-dev.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ BEGIN
1111
END;
1212
$$;
1313

14+
DROP VIEW IF EXISTS _timescaledb_catalog.chunk_constraint;
15+
1416
-- Drop obsolete chunk_constraint rows for inherited CHECK constraints on
1517
-- OSM chunks; PG inheritance handles propagation now.
1618
DELETE FROM _timescaledb_catalog.chunk_constraint cc

sql/views.sql

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -424,10 +424,6 @@ AS SELECT * FROM timescaledb_information.hypertable_compression_settings;
424424
CREATE OR REPLACE VIEW timescaledb_information.chunk_columnstore_settings AS
425425
SELECT * FROM timescaledb_information.chunk_compression_settings;
426426

427-
--temporary alias for bgw_job
428-
CREATE OR REPLACE VIEW _timescaledb_config.bgw_job AS
429-
SELECT * from _timescaledb_catalog.bgw_job;
430-
431427
-- chunk statistics view
432428
CREATE OR REPLACE VIEW timescaledb_information.stat_chunk_activity AS
433429
SELECT
@@ -496,6 +492,4 @@ LEFT JOIN _timescaledb_catalog.chunk c
496492
ON format('%I.%I', c.schema_name, c.table_name)::regclass = o.uncompressed_relid
497493
LEFT JOIN _timescaledb_catalog.hypertable h ON h.id = c.hypertable_id;
498494

499-
500-
GRANT SELECT ON ALL TABLES IN SCHEMA _timescaledb_config TO PUBLIC;
501495
GRANT SELECT ON ALL TABLES IN SCHEMA timescaledb_information TO PUBLIC;

sql/views_compat.sql

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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+
-- temporary views for compatibility
6+
7+
CREATE OR REPLACE VIEW _timescaledb_config.bgw_job AS
8+
SELECT * from _timescaledb_catalog.bgw_job;
9+
10+
CREATE OR REPLACE VIEW _timescaledb_catalog.chunk_constraint AS
11+
SELECT
12+
chunk_id,
13+
id AS dimension_slice_id,
14+
format('constraint_%s',id) AS constraint_name,
15+
NULL::text AS hypertable_constraint_name from _timescaledb_catalog.dimension_slice;
16+
17+
GRANT SELECT ON ALL TABLES IN SCHEMA _timescaledb_config TO PUBLIC;
18+
GRANT SELECT ON ALL TABLES IN SCHEMA _timescaledb_catalog TO PUBLIC;

test/expected/drop_rename_hypertable.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ SELECT schema, name FROM test.relation WHERE schema IN ('public', '_timescaledb_
183183
_timescaledb_catalog | bgw_job
184184
_timescaledb_catalog | chunk
185185
_timescaledb_catalog | chunk_column_stats
186+
_timescaledb_catalog | chunk_constraint
186187
_timescaledb_catalog | chunk_rewrite
187188
_timescaledb_catalog | compression_algorithm
188189
_timescaledb_catalog | compression_chunk_size

test/expected/pg_dump.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@ WHERE refclassid = 'pg_catalog.pg_extension'::pg_catalog.regclass AND
397397
_timescaledb_cache.cache_inval_bgw_job
398398
_timescaledb_cache.cache_inval_extension
399399
_timescaledb_cache.cache_inval_hypertable
400+
_timescaledb_catalog.chunk_constraint
400401
_timescaledb_catalog.chunk_rewrite
401402
_timescaledb_catalog.compression_algorithm
402403
_timescaledb_catalog.tablespace_id_seq

0 commit comments

Comments
 (0)