Post-release adjustments for 2.16.0

This commit is contained in:
Sven Klemm 2024-07-31 20:25:30 +02:00 committed by Sven Klemm
parent 059ac06e56
commit 801d32c63c
4 changed files with 27 additions and 26 deletions

View File

@ -81,7 +81,8 @@ set(OLD_REV_FILES
2.15.0--2.14.2.sql
2.15.1--2.15.0.sql
2.15.2--2.15.1.sql
2.15.3--2.15.2.sql)
2.15.3--2.15.2.sql
2.16.0--2.15.3.sql)
set(MODULE_PATHNAME "$libdir/timescaledb-${PROJECT_VERSION_MOD}")
set(LOADER_PATHNAME "$libdir/timescaledb")

View File

@ -0,0 +1,24 @@
DROP FUNCTION IF EXISTS _timescaledb_functions.cagg_get_bucket_function_info(INTEGER);
-- remove chunk column statistics related objects
DROP FUNCTION IF EXISTS @extschema@.enable_chunk_skipping(REGCLASS, NAME, BOOLEAN);
DROP FUNCTION IF EXISTS @extschema@.disable_chunk_skipping(REGCLASS, NAME, BOOLEAN);
ALTER EXTENSION timescaledb DROP TABLE _timescaledb_catalog.chunk_column_stats;
ALTER EXTENSION timescaledb DROP SEQUENCE _timescaledb_catalog.chunk_column_stats_id_seq;
DROP TABLE IF EXISTS _timescaledb_catalog.chunk_column_stats;
-- Add foreign key constraints back to compressed chunks
DO $$
DECLARE
chunkrelid regclass;
conname name;
conoid oid;
BEGIN
FOR chunkrelid, conname, conoid IN
SELECT format('%I.%I',ch.schema_name,ch.table_name)::regclass, con.conname, con.oid
FROM _timescaledb_catalog.hypertable ht
JOIN pg_constraint con ON con.contype = 'f' AND con.conrelid=format('%I.%I',ht.schema_name,ht.table_name)::regclass
JOIN _timescaledb_catalog.chunk ch on ch.hypertable_id=ht.compressed_hypertable_id and not ch.dropped
LOOP
EXECUTE format('ALTER TABLE %s ADD CONSTRAINT %I %s', chunkrelid, conname, pg_get_constraintdef(conoid));
END LOOP;
END $$;

View File

@ -1,24 +0,0 @@
DROP FUNCTION IF EXISTS _timescaledb_functions.cagg_get_bucket_function_info(INTEGER);
-- remove chunk column statistics related objects
DROP FUNCTION IF EXISTS @extschema@.enable_chunk_skipping(REGCLASS, NAME, BOOLEAN);
DROP FUNCTION IF EXISTS @extschema@.disable_chunk_skipping(REGCLASS, NAME, BOOLEAN);
ALTER EXTENSION timescaledb DROP TABLE _timescaledb_catalog.chunk_column_stats;
ALTER EXTENSION timescaledb DROP SEQUENCE _timescaledb_catalog.chunk_column_stats_id_seq;
DROP TABLE IF EXISTS _timescaledb_catalog.chunk_column_stats;
-- Add foreign key constraints back to compressed chunks
DO $$
DECLARE
chunkrelid regclass;
conname name;
conoid oid;
BEGIN
FOR chunkrelid, conname, conoid IN
SELECT format('%I.%I',ch.schema_name,ch.table_name)::regclass, con.conname, con.oid
FROM _timescaledb_catalog.hypertable ht
JOIN pg_constraint con ON con.contype = 'f' AND con.conrelid=format('%I.%I',ht.schema_name,ht.table_name)::regclass
JOIN _timescaledb_catalog.chunk ch on ch.hypertable_id=ht.compressed_hypertable_id and not ch.dropped
LOOP
EXECUTE format('ALTER TABLE %s ADD CONSTRAINT %I %s', chunkrelid, conname, pg_get_constraintdef(conoid));
END LOOP;
END $$;

View File

@ -1,3 +1,3 @@
version = 2.17.0-dev
update_from_version = 2.16.0
downgrade_to_version = 2.15.3
downgrade_to_version = 2.16.0