From acc787fac3d02bcc64e614d17333ec0a827f7aa1 Mon Sep 17 00:00:00 2001 From: Burak Velioglu Date: Fri, 27 Aug 2021 17:21:26 +0300 Subject: [PATCH] Downgrade drop_timeseries_table properly --- .../sql/downgrades/timeseries--10.2-1--10.1-1.sql | 10 +++++++++- src/test/regress/expected/multi_extension.out | 8 +++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/backend/timeseries/sql/downgrades/timeseries--10.2-1--10.1-1.sql b/src/backend/timeseries/sql/downgrades/timeseries--10.2-1--10.1-1.sql index eb3cf713c..d2cecb7e0 100644 --- a/src/backend/timeseries/sql/downgrades/timeseries--10.2-1--10.1-1.sql +++ b/src/backend/timeseries/sql/downgrades/timeseries--10.2-1--10.1-1.sql @@ -2,9 +2,17 @@ SET search_path TO timeseries; DROP FUNCTION pg_catalog.create_missing_partitions(regclass,timestamp with time zone,timestamp with time zone); DROP FUNCTION pg_catalog.create_timeseries_table(regclass,interval,integer,integer,timestamp with time zone,interval,interval); -DROP FUNCTION pg_catalog.drop_timeseries_table(regclass); DROP FUNCTION pg_catalog.get_missing_partition_ranges(regclass,timestamp with time zone,timestamp with time zone); +-- In Citus 10.2, we added another internal udf (drop_timeseries_table) +-- to be called by citus_drop_trigger. Since this script is executed when +-- downgrading Citus, we don't have drop_timeseries_table in citus.so. +-- For this reason, we first need to downgrade citus_drop_trigger so it doesn't +-- call drop_timeseries_table. +#include "../../../distributed/sql/udfs/citus_drop_trigger/10.0-1.sql" + +-- Now we can safely drop drop_timeseries_table as we downgraded citus_drop_trigger. +DROP FUNCTION pg_catalog.drop_timeseries_table(regclass); DROP TABLE tables; RESET search_path; diff --git a/src/test/regress/expected/multi_extension.out b/src/test/regress/expected/multi_extension.out index 91aef0c3e..751f30565 100644 --- a/src/test/regress/expected/multi_extension.out +++ b/src/test/regress/expected/multi_extension.out @@ -804,8 +804,14 @@ SELECT * FROM multi_extension.print_extension_changes(); | function citus_internal_delete_shard_metadata(bigint) void | function citus_internal_update_placement_metadata(bigint,integer,integer) void | function citus_internal_update_relation_colocation(oid,integer) void + | function create_missing_partitions(regclass,timestamp with time zone,timestamp with time zone) boolean + | function create_timeseries_table(regclass,interval,integer,integer,timestamp with time zone,interval,interval) void + | function drop_timeseries_table(regclass) void + | function get_missing_partition_ranges(regclass,timestamp with time zone,timestamp with time zone) TABLE(range_from_value text, range_to_value text) | function stop_metadata_sync_to_node(text,integer,boolean) void -(10 rows) + | schema timeseries + | table timeseries.tables +(16 rows) DROP TABLE multi_extension.prev_objects, multi_extension.extension_diff; -- show running version