mirror of https://github.com/citusdata/citus.git
Remove public schema dependency for 10.0 upgrades
This commit contains a subset of the changes that should be cherry
picked to 10.0 releases.
(cherry picked from commit 8e9cc229ff
)
pull/5106/head
parent
74985a0977
commit
d7b90e0804
|
@ -1,5 +1,16 @@
|
|||
-- citus--10.0-3--10.0-4
|
||||
|
||||
-- This migration file aims to fix 2 issues with upgrades on clusters
|
||||
|
||||
-- 1. a bug in public schema dependency for citus_tables view.
|
||||
--
|
||||
-- 10.0-3--10.0-4 was added later as a patch to fix a bug in our PG upgrade functions
|
||||
-- Users who do not have public schema in their clusters were unable to upgrade
|
||||
-- to Citus 10.x due to the citus_tables view that used to be created in public
|
||||
-- schema
|
||||
|
||||
#include "udfs/citus_tables/10.0-4.sql"
|
||||
|
||||
-- 2. a bug in our PG upgrade functions
|
||||
--
|
||||
-- Users who took the 9.5-2--10.0-1 upgrade path already have the fix, but users
|
||||
-- who took the 9.5-1--10.0-1 upgrade path do not. Hence, we repeat the CREATE OR
|
||||
|
|
|
@ -1,10 +1,16 @@
|
|||
-- citus--9.5-1--10.0-1
|
||||
-- citus--9.5-1--10.0-4
|
||||
|
||||
-- This migration file aims to fix the issues with upgrades on clusters without public schema.
|
||||
|
||||
-- This file is created by the following command, and some more changes in a separate commit
|
||||
-- cat citus--9.5-1--10.0-1.sql citus--10.0-1--10.0-2.sql citus--10.0-2--10.0-3.sql > citus--9.5-1--10.0-4.sql
|
||||
|
||||
-- copy of citus--9.5-1--10.0-1
|
||||
|
||||
DROP FUNCTION pg_catalog.upgrade_to_reference_table(regclass);
|
||||
DROP FUNCTION IF EXISTS pg_catalog.citus_total_relation_size(regclass);
|
||||
|
||||
#include "udfs/citus_total_relation_size/10.0-1.sql"
|
||||
#include "udfs/citus_tables/10.0-1.sql"
|
||||
#include "udfs/citus_finish_pg_upgrade/10.0-1.sql"
|
||||
#include "udfs/alter_distributed_table/10.0-1.sql"
|
||||
#include "udfs/alter_table_set_access_method/10.0-1.sql"
|
||||
|
@ -164,4 +170,48 @@ SELECT * FROM pg_catalog.citus_worker_stat_activity();
|
|||
ALTER VIEW citus.citus_worker_stat_activity SET SCHEMA pg_catalog;
|
||||
GRANT SELECT ON pg_catalog.citus_worker_stat_activity TO PUBLIC;
|
||||
|
||||
-- copy of citus--10.0-1--10.0-2
|
||||
|
||||
#include "../../columnar/sql/columnar--10.0-1--10.0-2.sql"
|
||||
|
||||
-- copy of citus--10.0-2--10.0-3
|
||||
|
||||
#include "udfs/citus_update_table_statistics/10.0-3.sql"
|
||||
|
||||
CREATE OR REPLACE FUNCTION master_update_table_statistics(relation regclass)
|
||||
RETURNS VOID
|
||||
LANGUAGE C STRICT
|
||||
AS 'MODULE_PATHNAME', $$citus_update_table_statistics$$;
|
||||
COMMENT ON FUNCTION pg_catalog.master_update_table_statistics(regclass)
|
||||
IS 'updates shard statistics of the given table';
|
||||
|
||||
CREATE OR REPLACE FUNCTION pg_catalog.citus_get_active_worker_nodes(OUT node_name text, OUT node_port bigint)
|
||||
RETURNS SETOF record
|
||||
LANGUAGE C STRICT ROWS 100
|
||||
AS 'MODULE_PATHNAME', $$citus_get_active_worker_nodes$$;
|
||||
COMMENT ON FUNCTION pg_catalog.citus_get_active_worker_nodes()
|
||||
IS 'fetch set of active worker nodes';
|
||||
|
||||
-- copy of citus--10.0-3--10.0-4
|
||||
|
||||
-- This migration file aims to fix 2 issues with upgrades on clusters
|
||||
|
||||
-- 1. a bug in public schema dependency for citus_tables view.
|
||||
--
|
||||
-- Users who do not have public schema in their clusters were unable to upgrade
|
||||
-- to Citus 10.x due to the citus_tables view that used to be created in public
|
||||
-- schema
|
||||
|
||||
#include "udfs/citus_tables/10.0-4.sql"
|
||||
|
||||
-- 2. a bug in our PG upgrade functions
|
||||
--
|
||||
-- Users who took the 9.5-2--10.0-1 upgrade path already have the fix, but users
|
||||
-- who took the 9.5-1--10.0-1 upgrade path do not. Hence, we repeat the CREATE OR
|
||||
-- REPLACE from the 9.5-2 definition for citus_prepare_pg_upgrade.
|
||||
|
||||
#include "udfs/citus_prepare_pg_upgrade/9.5-2.sql"
|
||||
#include "udfs/citus_finish_pg_upgrade/10.0-4.sql"
|
||||
|
||||
|
||||
RESET search_path;
|
|
@ -1,4 +0,0 @@
|
|||
/* citus--10.0-2--10.0-1.sql */
|
||||
#include "../../../columnar/sql/downgrades/columnar--10.0-2--10.0-1.sql"
|
||||
|
||||
REVOKE SELECT ON public.citus_tables FROM public;
|
|
@ -1,26 +0,0 @@
|
|||
-- citus--10.0-3--10.0-2
|
||||
-- this is a downgrade path that will revert the changes made in citus--10.0-2--10.0-3.sql
|
||||
|
||||
DROP FUNCTION pg_catalog.citus_update_table_statistics(regclass);
|
||||
|
||||
#include "../udfs/citus_update_table_statistics/10.0-1.sql"
|
||||
|
||||
CREATE OR REPLACE FUNCTION master_update_table_statistics(relation regclass)
|
||||
RETURNS VOID AS $$
|
||||
DECLARE
|
||||
colocated_tables regclass[];
|
||||
BEGIN
|
||||
SELECT get_colocated_table_array(relation) INTO colocated_tables;
|
||||
|
||||
PERFORM
|
||||
master_update_shard_statistics(shardid)
|
||||
FROM
|
||||
pg_dist_shard
|
||||
WHERE
|
||||
logicalrelid = ANY (colocated_tables);
|
||||
END;
|
||||
$$ LANGUAGE 'plpgsql';
|
||||
COMMENT ON FUNCTION master_update_table_statistics(regclass)
|
||||
IS 'updates shard statistics of the given table and its colocated tables';
|
||||
|
||||
DROP FUNCTION pg_catalog.citus_get_active_worker_nodes(OUT text, OUT bigint);
|
|
@ -1,9 +0,0 @@
|
|||
--
|
||||
-- 10.0-3--10.0-4 was added later as a patch to fix a bug in our PG upgrade functions
|
||||
--
|
||||
-- The upgrade fixes a bug in citus_(prepare|finish)_pg_upgrade. Given the old versions of
|
||||
-- these functions contain a bug it is better to _not_ restore the old version and keep
|
||||
-- the patched version of the function.
|
||||
--
|
||||
-- This is inline with the downgrade scripts for earlier versions of this patch
|
||||
--
|
|
@ -1,4 +1,51 @@
|
|||
-- citus--10.0-1--9.5-1
|
||||
-- citus--10.0-4--9.5-1
|
||||
|
||||
-- This migration file aims to fix the issues with upgrades on clusters without public schema.
|
||||
|
||||
-- This file is created by the following command, and some more changes in a separate commit
|
||||
-- cat citus--10.0-3--10.0-2.sql citus--10.0-2--10.0-1.sql citus--10.0-1--9.5-1.sql > citus--10.0-4--9.5-1.sql
|
||||
|
||||
-- copy of citus--10.0-4--10.0-3
|
||||
--
|
||||
-- 10.0-3--10.0-4 was added later as a patch to fix a bug in our PG upgrade functions
|
||||
--
|
||||
-- The upgrade fixes a bug in citus_(prepare|finish)_pg_upgrade. Given the old versions of
|
||||
-- these functions contain a bug it is better to _not_ restore the old version and keep
|
||||
-- the patched version of the function.
|
||||
--
|
||||
-- This is inline with the downgrade scripts for earlier versions of this patch
|
||||
--
|
||||
|
||||
-- copy of citus--10.0-3--10.0-2
|
||||
-- this is a downgrade path that will revert the changes made in citus--10.0-2--10.0-3.sql
|
||||
|
||||
DROP FUNCTION pg_catalog.citus_update_table_statistics(regclass);
|
||||
|
||||
#include "../udfs/citus_update_table_statistics/10.0-1.sql"
|
||||
|
||||
CREATE OR REPLACE FUNCTION master_update_table_statistics(relation regclass)
|
||||
RETURNS VOID AS $$
|
||||
DECLARE
|
||||
colocated_tables regclass[];
|
||||
BEGIN
|
||||
SELECT get_colocated_table_array(relation) INTO colocated_tables;
|
||||
|
||||
PERFORM
|
||||
master_update_shard_statistics(shardid)
|
||||
FROM
|
||||
pg_dist_shard
|
||||
WHERE
|
||||
logicalrelid = ANY (colocated_tables);
|
||||
END;
|
||||
$$ LANGUAGE 'plpgsql';
|
||||
COMMENT ON FUNCTION master_update_table_statistics(regclass)
|
||||
IS 'updates shard statistics of the given table and its colocated tables';
|
||||
|
||||
DROP FUNCTION pg_catalog.citus_get_active_worker_nodes(OUT text, OUT bigint);
|
||||
/* copy of citus--10.0-2--10.0-1.sql */
|
||||
#include "../../../columnar/sql/downgrades/columnar--10.0-2--10.0-1.sql"
|
||||
|
||||
-- copy of citus--10.0-1--9.5-1
|
||||
|
||||
-- In Citus 10.0, we added another internal udf (notify_constraint_dropped)
|
||||
-- to be called by citus_drop_trigger. Since this script is executed when
|
||||
|
@ -18,7 +65,8 @@ DROP FUNCTION pg_catalog.notify_constraint_dropped();
|
|||
|
||||
#include "../../../columnar/sql/downgrades/columnar--10.0-1--9.5-1.sql"
|
||||
|
||||
DROP VIEW public.citus_tables;
|
||||
DROP VIEW IF EXISTS pg_catalog.citus_tables;
|
||||
DROP VIEW IF EXISTS public.citus_tables;
|
||||
DROP FUNCTION pg_catalog.alter_distributed_table(regclass, text, int, text, boolean);
|
||||
DROP FUNCTION pg_catalog.alter_table_set_access_method(regclass, text);
|
||||
DROP FUNCTION pg_catalog.citus_total_relation_size(regclass,boolean);
|
|
@ -0,0 +1,38 @@
|
|||
DO $$
|
||||
declare
|
||||
citus_tables_create_query text;
|
||||
BEGIN
|
||||
citus_tables_create_query=$CTCQ$
|
||||
CREATE OR REPLACE VIEW %I.citus_tables AS
|
||||
SELECT
|
||||
logicalrelid AS table_name,
|
||||
CASE WHEN partkey IS NOT NULL THEN 'distributed' ELSE 'reference' END AS citus_table_type,
|
||||
coalesce(column_to_column_name(logicalrelid, partkey), '<none>') AS distribution_column,
|
||||
colocationid AS colocation_id,
|
||||
pg_size_pretty(citus_total_relation_size(logicalrelid, fail_on_error := false)) AS table_size,
|
||||
(select count(*) from pg_dist_shard where logicalrelid = p.logicalrelid) AS shard_count,
|
||||
pg_get_userbyid(relowner) AS table_owner,
|
||||
amname AS access_method
|
||||
FROM
|
||||
pg_dist_partition p
|
||||
JOIN
|
||||
pg_class c ON (p.logicalrelid = c.oid)
|
||||
LEFT JOIN
|
||||
pg_am a ON (a.oid = c.relam)
|
||||
WHERE
|
||||
partkey IS NOT NULL OR repmodel = 't'
|
||||
ORDER BY
|
||||
logicalrelid::text;
|
||||
$CTCQ$;
|
||||
|
||||
IF EXISTS (SELECT 1 FROM pg_namespace WHERE nspname = 'public') THEN
|
||||
EXECUTE format(citus_tables_create_query, 'public');
|
||||
GRANT SELECT ON public.citus_tables TO public;
|
||||
ELSE
|
||||
EXECUTE format(citus_tables_create_query, 'citus');
|
||||
ALTER VIEW citus.citus_tables SET SCHEMA pg_catalog;
|
||||
GRANT SELECT ON pg_catalog.citus_tables TO public;
|
||||
END IF;
|
||||
|
||||
END;
|
||||
$$;
|
|
@ -1,20 +1,38 @@
|
|||
CREATE VIEW public.citus_tables AS
|
||||
SELECT
|
||||
logicalrelid AS table_name,
|
||||
CASE WHEN partkey IS NOT NULL THEN 'distributed' ELSE 'reference' END AS citus_table_type,
|
||||
coalesce(column_to_column_name(logicalrelid, partkey), '<none>') AS distribution_column,
|
||||
colocationid AS colocation_id,
|
||||
pg_size_pretty(citus_total_relation_size(logicalrelid, fail_on_error := false)) AS table_size,
|
||||
(select count(*) from pg_dist_shard where logicalrelid = p.logicalrelid) AS shard_count,
|
||||
pg_get_userbyid(relowner) AS table_owner,
|
||||
amname AS access_method
|
||||
FROM
|
||||
pg_dist_partition p
|
||||
JOIN
|
||||
pg_class c ON (p.logicalrelid = c.oid)
|
||||
LEFT JOIN
|
||||
pg_am a ON (a.oid = c.relam)
|
||||
WHERE
|
||||
partkey IS NOT NULL OR repmodel = 't'
|
||||
ORDER BY
|
||||
logicalrelid::text;
|
||||
DO $$
|
||||
declare
|
||||
citus_tables_create_query text;
|
||||
BEGIN
|
||||
citus_tables_create_query=$CTCQ$
|
||||
CREATE OR REPLACE VIEW %I.citus_tables AS
|
||||
SELECT
|
||||
logicalrelid AS table_name,
|
||||
CASE WHEN partkey IS NOT NULL THEN 'distributed' ELSE 'reference' END AS citus_table_type,
|
||||
coalesce(column_to_column_name(logicalrelid, partkey), '<none>') AS distribution_column,
|
||||
colocationid AS colocation_id,
|
||||
pg_size_pretty(citus_total_relation_size(logicalrelid, fail_on_error := false)) AS table_size,
|
||||
(select count(*) from pg_dist_shard where logicalrelid = p.logicalrelid) AS shard_count,
|
||||
pg_get_userbyid(relowner) AS table_owner,
|
||||
amname AS access_method
|
||||
FROM
|
||||
pg_dist_partition p
|
||||
JOIN
|
||||
pg_class c ON (p.logicalrelid = c.oid)
|
||||
LEFT JOIN
|
||||
pg_am a ON (a.oid = c.relam)
|
||||
WHERE
|
||||
partkey IS NOT NULL OR repmodel = 't'
|
||||
ORDER BY
|
||||
logicalrelid::text;
|
||||
$CTCQ$;
|
||||
|
||||
IF EXISTS (SELECT 1 FROM pg_namespace WHERE nspname = 'public') THEN
|
||||
EXECUTE format(citus_tables_create_query, 'public');
|
||||
GRANT SELECT ON public.citus_tables TO public;
|
||||
ELSE
|
||||
EXECUTE format(citus_tables_create_query, 'citus');
|
||||
ALTER VIEW citus.citus_tables SET SCHEMA pg_catalog;
|
||||
GRANT SELECT ON pg_catalog.citus_tables TO public;
|
||||
END IF;
|
||||
|
||||
END;
|
||||
$$;
|
||||
|
|
|
@ -16,6 +16,7 @@ SELECT substring(:'server_version', '\d+')::int > 11 AS version_above_eleven;
|
|||
(1 row)
|
||||
|
||||
SET citus.next_shard_id TO 580000;
|
||||
CREATE SCHEMA multi_extension;
|
||||
SELECT $definition$
|
||||
CREATE OR REPLACE FUNCTION test.maintenance_worker()
|
||||
RETURNS pg_stat_activity
|
||||
|
@ -42,13 +43,14 @@ END;
|
|||
$$;
|
||||
$definition$ create_function_test_maintenance_worker
|
||||
\gset
|
||||
CREATE TABLE prev_objects(description text);
|
||||
CREATE TABLE extension_diff(previous_object text COLLATE "C",
|
||||
CREATE TABLE multi_extension.prev_objects(description text);
|
||||
CREATE TABLE multi_extension.extension_diff(previous_object text COLLATE "C",
|
||||
current_object text COLLATE "C");
|
||||
CREATE FUNCTION print_extension_changes()
|
||||
CREATE FUNCTION multi_extension.print_extension_changes()
|
||||
RETURNS TABLE(previous_object text, current_object text)
|
||||
AS $func$
|
||||
BEGIN
|
||||
SET LOCAL search_path TO multi_extension;
|
||||
TRUNCATE TABLE extension_diff;
|
||||
|
||||
CREATE TABLE current_objects AS
|
||||
|
@ -128,7 +130,7 @@ ALTER EXTENSION citus UPDATE TO '9.1-1';
|
|||
ALTER EXTENSION citus UPDATE TO '9.2-1';
|
||||
ALTER EXTENSION citus UPDATE TO '9.2-2';
|
||||
-- Snapshot of state at 9.2-2
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
| event trigger citus_cascade_to_partition
|
||||
|
@ -325,7 +327,7 @@ SELECT * FROM print_extension_changes();
|
|||
ALTER EXTENSION citus UPDATE TO '9.2-4';
|
||||
ALTER EXTENSION citus UPDATE TO '9.2-2';
|
||||
-- Should be empty result since upgrade+downgrade should be a no-op
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
(0 rows)
|
||||
|
@ -340,7 +342,7 @@ ALTER EXTENSION citus UPDATE TO '9.3-1';
|
|||
ERROR: extension "citus" has no update path from version "9.2-2" to version "9.3-1"
|
||||
ALTER EXTENSION citus UPDATE TO '9.2-4';
|
||||
-- Snapshot of state at 9.2-4
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
(0 rows)
|
||||
|
@ -349,14 +351,14 @@ SELECT * FROM print_extension_changes();
|
|||
ALTER EXTENSION citus UPDATE TO '9.3-2';
|
||||
ALTER EXTENSION citus UPDATE TO '9.2-4';
|
||||
-- Should be empty result since upgrade+downgrade should be a no-op
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
(0 rows)
|
||||
|
||||
-- Snapshot of state at 9.3-2
|
||||
ALTER EXTENSION citus UPDATE TO '9.3-2';
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
| function citus_remote_connection_stats()
|
||||
|
@ -370,14 +372,14 @@ SELECT * FROM print_extension_changes();
|
|||
ALTER EXTENSION citus UPDATE TO '9.4-1';
|
||||
ALTER EXTENSION citus UPDATE TO '9.3-2';
|
||||
-- Should be empty result since upgrade+downgrade should be a no-op
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
(0 rows)
|
||||
|
||||
-- Snapshot of state at 9.4-1
|
||||
ALTER EXTENSION citus UPDATE TO '9.4-1';
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
| function worker_last_saved_explain_analyze()
|
||||
|
@ -389,20 +391,20 @@ ALTER EXTENSION citus UPDATE TO '9.4-2';
|
|||
ALTER EXTENSION citus UPDATE TO '9.4-1';
|
||||
-- Should be empty result, even though the downgrade doesn't undo the upgrade, the
|
||||
-- function signature doesn't change, which is reflected here.
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
(0 rows)
|
||||
|
||||
ALTER EXTENSION citus UPDATE TO '9.4-2';
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
(0 rows)
|
||||
|
||||
-- Snapshot of state at 9.4-1
|
||||
ALTER EXTENSION citus UPDATE TO '9.4-1';
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
(0 rows)
|
||||
|
@ -433,14 +435,14 @@ ROLLBACK;
|
|||
-- now we can downgrade as there is no citus local table
|
||||
ALTER EXTENSION citus UPDATE TO '9.4-1';
|
||||
-- Should be empty result since upgrade+downgrade should be a no-op
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
(0 rows)
|
||||
|
||||
-- Snapshot of state at 9.5-1
|
||||
ALTER EXTENSION citus UPDATE TO '9.5-1';
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
function master_drop_sequences(text[]) |
|
||||
|
@ -460,36 +462,38 @@ ALTER EXTENSION citus UPDATE TO '9.5-2';
|
|||
ALTER EXTENSION citus UPDATE TO '9.5-1';
|
||||
-- Should be empty result, even though the downgrade doesn't undo the upgrade, the
|
||||
-- function signature doesn't change, which is reflected here.
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
(0 rows)
|
||||
|
||||
ALTER EXTENSION citus UPDATE TO '9.5-2';
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
(0 rows)
|
||||
|
||||
-- Snapshot of state at 9.5-1
|
||||
ALTER EXTENSION citus UPDATE TO '9.5-1';
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
(0 rows)
|
||||
|
||||
-- Test downgrade to 9.5-1 from 10.0-1
|
||||
ALTER EXTENSION citus UPDATE TO '10.0-1';
|
||||
-- We removed the upgrade paths to 10.0-1, 10.0-2 and 10.0-3 due to a bug that blocked
|
||||
-- upgrades to 10.0, Therefore we test upgrades to 10.0-4 instead
|
||||
-- Test downgrade to 9.5-1 from 10.0-4
|
||||
ALTER EXTENSION citus UPDATE TO '10.0-4';
|
||||
ALTER EXTENSION citus UPDATE TO '9.5-1';
|
||||
-- Should be empty result since upgrade+downgrade should be a no-op
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
(0 rows)
|
||||
|
||||
-- Snapshot of state at 10.0-1
|
||||
ALTER EXTENSION citus UPDATE TO '10.0-1';
|
||||
SELECT * FROM print_extension_changes();
|
||||
-- Snapshot of state at 10.0-4
|
||||
ALTER EXTENSION citus UPDATE TO '10.0-4';
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
function citus_total_relation_size(regclass) |
|
||||
|
@ -530,6 +534,7 @@ SELECT * FROM print_extension_changes();
|
|||
| function citus_dist_shard_cache_invalidate()
|
||||
| function citus_drain_node(text,integer,citus.shard_transfer_mode,name)
|
||||
| function citus_drop_all_shards(regclass,text,text)
|
||||
| function citus_get_active_worker_nodes()
|
||||
| function citus_internal.columnar_ensure_objects_exist()
|
||||
| function citus_move_shard_placement(bigint,text,integer,text,integer,citus.shard_transfer_mode)
|
||||
| function citus_remove_node(text,integer)
|
||||
|
@ -557,61 +562,39 @@ SELECT * FROM print_extension_changes();
|
|||
| table columnar.options
|
||||
| table columnar.stripe
|
||||
| view citus_shards
|
||||
| view citus_tables
|
||||
| view public.citus_tables
|
||||
| view time_partitions
|
||||
(67 rows)
|
||||
(68 rows)
|
||||
|
||||
-- Test downgrade to 10.0-1 from 10.0-2
|
||||
ALTER EXTENSION citus UPDATE TO '10.0-2';
|
||||
ALTER EXTENSION citus UPDATE TO '10.0-1';
|
||||
-- Should be empty result since upgrade+downgrade should be a no-op
|
||||
SELECT * FROM print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
(0 rows)
|
||||
|
||||
-- Snapshot of state at 10.0-2
|
||||
ALTER EXTENSION citus UPDATE TO '10.0-2';
|
||||
SELECT * FROM print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
(0 rows)
|
||||
|
||||
-- Test downgrade to 10.0-2 from 10.0-3
|
||||
ALTER EXTENSION citus UPDATE TO '10.0-3';
|
||||
ALTER EXTENSION citus UPDATE TO '10.0-2';
|
||||
-- Should be empty result since upgrade+downgrade should be a no-op
|
||||
SELECT * FROM print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
(0 rows)
|
||||
|
||||
-- Snapshot of state at 10.0-3
|
||||
ALTER EXTENSION citus UPDATE TO '10.0-3';
|
||||
SELECT * FROM print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
| function citus_get_active_worker_nodes()
|
||||
(1 row)
|
||||
|
||||
-- Test downgrade to 10.0-3 from 10.0-4
|
||||
-- check that we depend on the existence of public schema, and we can not drop it now
|
||||
DROP SCHEMA public;
|
||||
ERROR: cannot drop schema public because other objects depend on it
|
||||
DETAIL: extension citus depends on schema public
|
||||
HINT: Use DROP ... CASCADE to drop the dependent objects too.
|
||||
-- verify that citus_tables view is on pg_catalog if public schema is absent.
|
||||
ALTER EXTENSION citus UPDATE TO '9.5-1';
|
||||
DROP SCHEMA public;
|
||||
ALTER EXTENSION citus UPDATE TO '10.0-4';
|
||||
ALTER EXTENSION citus UPDATE TO '10.0-3';
|
||||
-- Should be empty result, even though the downgrade doesn't undo the upgrade, the
|
||||
-- function signature doesn't change, which is reflected here.
|
||||
SELECT * FROM print_extension_changes();
|
||||
previous_object | current_object
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
(0 rows)
|
||||
view public.citus_tables |
|
||||
| view citus_tables
|
||||
(2 rows)
|
||||
|
||||
-- Snapshot of state at 10.0-4
|
||||
-- recreate public schema, and recreate citus_tables in the public schema by default
|
||||
CREATE SCHEMA public;
|
||||
GRANT ALL ON SCHEMA public TO public;
|
||||
ALTER EXTENSION citus UPDATE TO '9.5-1';
|
||||
ALTER EXTENSION citus UPDATE TO '10.0-4';
|
||||
SELECT * FROM print_extension_changes();
|
||||
previous_object | current_object
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
(0 rows)
|
||||
view citus_tables |
|
||||
| view public.citus_tables
|
||||
(2 rows)
|
||||
|
||||
DROP TABLE prev_objects, extension_diff;
|
||||
DROP TABLE multi_extension.prev_objects, multi_extension.extension_diff;
|
||||
-- show running version
|
||||
SHOW citus.version;
|
||||
citus.version
|
||||
|
@ -954,3 +937,7 @@ SELECT count(*) FROM pg_stat_activity WHERE application_name = 'Citus Maintenanc
|
|||
(1 row)
|
||||
|
||||
DROP TABLE version_mismatch_table;
|
||||
DROP SCHEMA multi_extension;
|
||||
ERROR: cannot drop schema multi_extension because other objects depend on it
|
||||
DETAIL: function multi_extension.print_extension_changes() depends on schema multi_extension
|
||||
HINT: Use DROP ... CASCADE to drop the dependent objects too.
|
||||
|
|
|
@ -16,6 +16,7 @@ SELECT substring(:'server_version', '\d+')::int > 11 AS version_above_eleven;
|
|||
(1 row)
|
||||
|
||||
SET citus.next_shard_id TO 580000;
|
||||
CREATE SCHEMA multi_extension;
|
||||
SELECT $definition$
|
||||
CREATE OR REPLACE FUNCTION test.maintenance_worker()
|
||||
RETURNS pg_stat_activity
|
||||
|
@ -42,13 +43,14 @@ END;
|
|||
$$;
|
||||
$definition$ create_function_test_maintenance_worker
|
||||
\gset
|
||||
CREATE TABLE prev_objects(description text);
|
||||
CREATE TABLE extension_diff(previous_object text COLLATE "C",
|
||||
CREATE TABLE multi_extension.prev_objects(description text);
|
||||
CREATE TABLE multi_extension.extension_diff(previous_object text COLLATE "C",
|
||||
current_object text COLLATE "C");
|
||||
CREATE FUNCTION print_extension_changes()
|
||||
CREATE FUNCTION multi_extension.print_extension_changes()
|
||||
RETURNS TABLE(previous_object text, current_object text)
|
||||
AS $func$
|
||||
BEGIN
|
||||
SET LOCAL search_path TO multi_extension;
|
||||
TRUNCATE TABLE extension_diff;
|
||||
|
||||
CREATE TABLE current_objects AS
|
||||
|
@ -128,7 +130,7 @@ ALTER EXTENSION citus UPDATE TO '9.1-1';
|
|||
ALTER EXTENSION citus UPDATE TO '9.2-1';
|
||||
ALTER EXTENSION citus UPDATE TO '9.2-2';
|
||||
-- Snapshot of state at 9.2-2
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
| event trigger citus_cascade_to_partition
|
||||
|
@ -325,7 +327,7 @@ SELECT * FROM print_extension_changes();
|
|||
ALTER EXTENSION citus UPDATE TO '9.2-4';
|
||||
ALTER EXTENSION citus UPDATE TO '9.2-2';
|
||||
-- Should be empty result since upgrade+downgrade should be a no-op
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
(0 rows)
|
||||
|
@ -340,7 +342,7 @@ ALTER EXTENSION citus UPDATE TO '9.3-1';
|
|||
ERROR: extension "citus" has no update path from version "9.2-2" to version "9.3-1"
|
||||
ALTER EXTENSION citus UPDATE TO '9.2-4';
|
||||
-- Snapshot of state at 9.2-4
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
(0 rows)
|
||||
|
@ -349,14 +351,14 @@ SELECT * FROM print_extension_changes();
|
|||
ALTER EXTENSION citus UPDATE TO '9.3-2';
|
||||
ALTER EXTENSION citus UPDATE TO '9.2-4';
|
||||
-- Should be empty result since upgrade+downgrade should be a no-op
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
(0 rows)
|
||||
|
||||
-- Snapshot of state at 9.3-2
|
||||
ALTER EXTENSION citus UPDATE TO '9.3-2';
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
| function citus_remote_connection_stats()
|
||||
|
@ -370,14 +372,14 @@ SELECT * FROM print_extension_changes();
|
|||
ALTER EXTENSION citus UPDATE TO '9.4-1';
|
||||
ALTER EXTENSION citus UPDATE TO '9.3-2';
|
||||
-- Should be empty result since upgrade+downgrade should be a no-op
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
(0 rows)
|
||||
|
||||
-- Snapshot of state at 9.4-1
|
||||
ALTER EXTENSION citus UPDATE TO '9.4-1';
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
| function worker_last_saved_explain_analyze()
|
||||
|
@ -389,20 +391,20 @@ ALTER EXTENSION citus UPDATE TO '9.4-2';
|
|||
ALTER EXTENSION citus UPDATE TO '9.4-1';
|
||||
-- Should be empty result, even though the downgrade doesn't undo the upgrade, the
|
||||
-- function signature doesn't change, which is reflected here.
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
(0 rows)
|
||||
|
||||
ALTER EXTENSION citus UPDATE TO '9.4-2';
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
(0 rows)
|
||||
|
||||
-- Snapshot of state at 9.4-1
|
||||
ALTER EXTENSION citus UPDATE TO '9.4-1';
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
(0 rows)
|
||||
|
@ -433,14 +435,14 @@ ROLLBACK;
|
|||
-- now we can downgrade as there is no citus local table
|
||||
ALTER EXTENSION citus UPDATE TO '9.4-1';
|
||||
-- Should be empty result since upgrade+downgrade should be a no-op
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
(0 rows)
|
||||
|
||||
-- Snapshot of state at 9.5-1
|
||||
ALTER EXTENSION citus UPDATE TO '9.5-1';
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
function master_drop_sequences(text[]) |
|
||||
|
@ -460,36 +462,38 @@ ALTER EXTENSION citus UPDATE TO '9.5-2';
|
|||
ALTER EXTENSION citus UPDATE TO '9.5-1';
|
||||
-- Should be empty result, even though the downgrade doesn't undo the upgrade, the
|
||||
-- function signature doesn't change, which is reflected here.
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
(0 rows)
|
||||
|
||||
ALTER EXTENSION citus UPDATE TO '9.5-2';
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
(0 rows)
|
||||
|
||||
-- Snapshot of state at 9.5-1
|
||||
ALTER EXTENSION citus UPDATE TO '9.5-1';
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
(0 rows)
|
||||
|
||||
-- Test downgrade to 9.5-1 from 10.0-1
|
||||
ALTER EXTENSION citus UPDATE TO '10.0-1';
|
||||
-- We removed the upgrade paths to 10.0-1, 10.0-2 and 10.0-3 due to a bug that blocked
|
||||
-- upgrades to 10.0, Therefore we test upgrades to 10.0-4 instead
|
||||
-- Test downgrade to 9.5-1 from 10.0-4
|
||||
ALTER EXTENSION citus UPDATE TO '10.0-4';
|
||||
ALTER EXTENSION citus UPDATE TO '9.5-1';
|
||||
-- Should be empty result since upgrade+downgrade should be a no-op
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
(0 rows)
|
||||
|
||||
-- Snapshot of state at 10.0-1
|
||||
ALTER EXTENSION citus UPDATE TO '10.0-1';
|
||||
SELECT * FROM print_extension_changes();
|
||||
-- Snapshot of state at 10.0-4
|
||||
ALTER EXTENSION citus UPDATE TO '10.0-4';
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
function citus_total_relation_size(regclass) |
|
||||
|
@ -527,6 +531,7 @@ SELECT * FROM print_extension_changes();
|
|||
| function citus_dist_shard_cache_invalidate()
|
||||
| function citus_drain_node(text,integer,citus.shard_transfer_mode,name)
|
||||
| function citus_drop_all_shards(regclass,text,text)
|
||||
| function citus_get_active_worker_nodes()
|
||||
| function citus_internal.columnar_ensure_objects_exist()
|
||||
| function citus_move_shard_placement(bigint,text,integer,text,integer,citus.shard_transfer_mode)
|
||||
| function citus_remove_node(text,integer)
|
||||
|
@ -553,61 +558,39 @@ SELECT * FROM print_extension_changes();
|
|||
| table columnar.options
|
||||
| table columnar.stripe
|
||||
| view citus_shards
|
||||
| view citus_tables
|
||||
| view public.citus_tables
|
||||
| view time_partitions
|
||||
(63 rows)
|
||||
(64 rows)
|
||||
|
||||
-- Test downgrade to 10.0-1 from 10.0-2
|
||||
ALTER EXTENSION citus UPDATE TO '10.0-2';
|
||||
ALTER EXTENSION citus UPDATE TO '10.0-1';
|
||||
-- Should be empty result since upgrade+downgrade should be a no-op
|
||||
SELECT * FROM print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
(0 rows)
|
||||
|
||||
-- Snapshot of state at 10.0-2
|
||||
ALTER EXTENSION citus UPDATE TO '10.0-2';
|
||||
SELECT * FROM print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
(0 rows)
|
||||
|
||||
-- Test downgrade to 10.0-2 from 10.0-3
|
||||
ALTER EXTENSION citus UPDATE TO '10.0-3';
|
||||
ALTER EXTENSION citus UPDATE TO '10.0-2';
|
||||
-- Should be empty result since upgrade+downgrade should be a no-op
|
||||
SELECT * FROM print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
(0 rows)
|
||||
|
||||
-- Snapshot of state at 10.0-3
|
||||
ALTER EXTENSION citus UPDATE TO '10.0-3';
|
||||
SELECT * FROM print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
| function citus_get_active_worker_nodes()
|
||||
(1 row)
|
||||
|
||||
-- Test downgrade to 10.0-3 from 10.0-4
|
||||
-- check that we depend on the existence of public schema, and we can not drop it now
|
||||
DROP SCHEMA public;
|
||||
ERROR: cannot drop schema public because other objects depend on it
|
||||
DETAIL: extension citus depends on schema public
|
||||
HINT: Use DROP ... CASCADE to drop the dependent objects too.
|
||||
-- verify that citus_tables view is on pg_catalog if public schema is absent.
|
||||
ALTER EXTENSION citus UPDATE TO '9.5-1';
|
||||
DROP SCHEMA public;
|
||||
ALTER EXTENSION citus UPDATE TO '10.0-4';
|
||||
ALTER EXTENSION citus UPDATE TO '10.0-3';
|
||||
-- Should be empty result, even though the downgrade doesn't undo the upgrade, the
|
||||
-- function signature doesn't change, which is reflected here.
|
||||
SELECT * FROM print_extension_changes();
|
||||
previous_object | current_object
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
(0 rows)
|
||||
view public.citus_tables |
|
||||
| view citus_tables
|
||||
(2 rows)
|
||||
|
||||
-- Snapshot of state at 10.0-4
|
||||
-- recreate public schema, and recreate citus_tables in the public schema by default
|
||||
CREATE SCHEMA public;
|
||||
GRANT ALL ON SCHEMA public TO public;
|
||||
ALTER EXTENSION citus UPDATE TO '9.5-1';
|
||||
ALTER EXTENSION citus UPDATE TO '10.0-4';
|
||||
SELECT * FROM print_extension_changes();
|
||||
previous_object | current_object
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
(0 rows)
|
||||
view citus_tables |
|
||||
| view public.citus_tables
|
||||
(2 rows)
|
||||
|
||||
DROP TABLE prev_objects, extension_diff;
|
||||
DROP TABLE multi_extension.prev_objects, multi_extension.extension_diff;
|
||||
-- show running version
|
||||
SHOW citus.version;
|
||||
citus.version
|
||||
|
@ -950,3 +933,7 @@ SELECT count(*) FROM pg_stat_activity WHERE application_name = 'Citus Maintenanc
|
|||
(1 row)
|
||||
|
||||
DROP TABLE version_mismatch_table;
|
||||
DROP SCHEMA multi_extension;
|
||||
ERROR: cannot drop schema multi_extension because other objects depend on it
|
||||
DETAIL: function multi_extension.print_extension_changes() depends on schema multi_extension
|
||||
HINT: Use DROP ... CASCADE to drop the dependent objects too.
|
||||
|
|
|
@ -13,6 +13,7 @@ SHOW server_version \gset
|
|||
SELECT substring(:'server_version', '\d+')::int > 11 AS version_above_eleven;
|
||||
|
||||
SET citus.next_shard_id TO 580000;
|
||||
CREATE SCHEMA multi_extension;
|
||||
|
||||
SELECT $definition$
|
||||
CREATE OR REPLACE FUNCTION test.maintenance_worker()
|
||||
|
@ -41,14 +42,15 @@ $$;
|
|||
$definition$ create_function_test_maintenance_worker
|
||||
\gset
|
||||
|
||||
CREATE TABLE prev_objects(description text);
|
||||
CREATE TABLE extension_diff(previous_object text COLLATE "C",
|
||||
CREATE TABLE multi_extension.prev_objects(description text);
|
||||
CREATE TABLE multi_extension.extension_diff(previous_object text COLLATE "C",
|
||||
current_object text COLLATE "C");
|
||||
|
||||
CREATE FUNCTION print_extension_changes()
|
||||
CREATE FUNCTION multi_extension.print_extension_changes()
|
||||
RETURNS TABLE(previous_object text, current_object text)
|
||||
AS $func$
|
||||
BEGIN
|
||||
SET LOCAL search_path TO multi_extension;
|
||||
TRUNCATE TABLE extension_diff;
|
||||
|
||||
CREATE TABLE current_objects AS
|
||||
|
@ -126,13 +128,13 @@ ALTER EXTENSION citus UPDATE TO '9.1-1';
|
|||
ALTER EXTENSION citus UPDATE TO '9.2-1';
|
||||
ALTER EXTENSION citus UPDATE TO '9.2-2';
|
||||
-- Snapshot of state at 9.2-2
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
|
||||
-- Test downgrade to 9.2-2 from 9.2-4
|
||||
ALTER EXTENSION citus UPDATE TO '9.2-4';
|
||||
ALTER EXTENSION citus UPDATE TO '9.2-2';
|
||||
-- Should be empty result since upgrade+downgrade should be a no-op
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
|
||||
/*
|
||||
* As we mistakenly bumped schema version to 9.3-1 in a bad release, we support
|
||||
|
@ -144,41 +146,41 @@ ALTER EXTENSION citus UPDATE TO '9.3-1';
|
|||
|
||||
ALTER EXTENSION citus UPDATE TO '9.2-4';
|
||||
-- Snapshot of state at 9.2-4
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
|
||||
-- Test downgrade to 9.2-4 from 9.3-2
|
||||
ALTER EXTENSION citus UPDATE TO '9.3-2';
|
||||
ALTER EXTENSION citus UPDATE TO '9.2-4';
|
||||
-- Should be empty result since upgrade+downgrade should be a no-op
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
|
||||
-- Snapshot of state at 9.3-2
|
||||
ALTER EXTENSION citus UPDATE TO '9.3-2';
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
|
||||
-- Test downgrade to 9.3-2 from 9.4-1
|
||||
ALTER EXTENSION citus UPDATE TO '9.4-1';
|
||||
ALTER EXTENSION citus UPDATE TO '9.3-2';
|
||||
-- Should be empty result since upgrade+downgrade should be a no-op
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
|
||||
-- Snapshot of state at 9.4-1
|
||||
ALTER EXTENSION citus UPDATE TO '9.4-1';
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
|
||||
-- Test upgrade paths for backported citus_pg_upgrade functions
|
||||
ALTER EXTENSION citus UPDATE TO '9.4-2';
|
||||
ALTER EXTENSION citus UPDATE TO '9.4-1';
|
||||
-- Should be empty result, even though the downgrade doesn't undo the upgrade, the
|
||||
-- function signature doesn't change, which is reflected here.
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
|
||||
ALTER EXTENSION citus UPDATE TO '9.4-2';
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
|
||||
-- Snapshot of state at 9.4-1
|
||||
ALTER EXTENSION citus UPDATE TO '9.4-1';
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
|
||||
-- Test downgrade to 9.4-1 from 9.5-1
|
||||
ALTER EXTENSION citus UPDATE TO '9.5-1';
|
||||
|
@ -196,68 +198,56 @@ ROLLBACK;
|
|||
ALTER EXTENSION citus UPDATE TO '9.4-1';
|
||||
|
||||
-- Should be empty result since upgrade+downgrade should be a no-op
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
|
||||
-- Snapshot of state at 9.5-1
|
||||
ALTER EXTENSION citus UPDATE TO '9.5-1';
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
|
||||
-- Test upgrade paths for backported citus_pg_upgrade functions
|
||||
ALTER EXTENSION citus UPDATE TO '9.5-2';
|
||||
ALTER EXTENSION citus UPDATE TO '9.5-1';
|
||||
-- Should be empty result, even though the downgrade doesn't undo the upgrade, the
|
||||
-- function signature doesn't change, which is reflected here.
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
|
||||
ALTER EXTENSION citus UPDATE TO '9.5-2';
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
|
||||
-- Snapshot of state at 9.5-1
|
||||
ALTER EXTENSION citus UPDATE TO '9.5-1';
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
|
||||
-- Test downgrade to 9.5-1 from 10.0-1
|
||||
ALTER EXTENSION citus UPDATE TO '10.0-1';
|
||||
-- We removed the upgrade paths to 10.0-1, 10.0-2 and 10.0-3 due to a bug that blocked
|
||||
-- upgrades to 10.0, Therefore we test upgrades to 10.0-4 instead
|
||||
|
||||
-- Test downgrade to 9.5-1 from 10.0-4
|
||||
ALTER EXTENSION citus UPDATE TO '10.0-4';
|
||||
ALTER EXTENSION citus UPDATE TO '9.5-1';
|
||||
-- Should be empty result since upgrade+downgrade should be a no-op
|
||||
SELECT * FROM print_extension_changes();
|
||||
|
||||
-- Snapshot of state at 10.0-1
|
||||
ALTER EXTENSION citus UPDATE TO '10.0-1';
|
||||
SELECT * FROM print_extension_changes();
|
||||
|
||||
-- Test downgrade to 10.0-1 from 10.0-2
|
||||
ALTER EXTENSION citus UPDATE TO '10.0-2';
|
||||
ALTER EXTENSION citus UPDATE TO '10.0-1';
|
||||
-- Should be empty result since upgrade+downgrade should be a no-op
|
||||
SELECT * FROM print_extension_changes();
|
||||
|
||||
-- Snapshot of state at 10.0-2
|
||||
ALTER EXTENSION citus UPDATE TO '10.0-2';
|
||||
SELECT * FROM print_extension_changes();
|
||||
|
||||
-- Test downgrade to 10.0-2 from 10.0-3
|
||||
ALTER EXTENSION citus UPDATE TO '10.0-3';
|
||||
ALTER EXTENSION citus UPDATE TO '10.0-2';
|
||||
-- Should be empty result since upgrade+downgrade should be a no-op
|
||||
SELECT * FROM print_extension_changes();
|
||||
|
||||
-- Snapshot of state at 10.0-3
|
||||
ALTER EXTENSION citus UPDATE TO '10.0-3';
|
||||
SELECT * FROM print_extension_changes();
|
||||
|
||||
-- Test downgrade to 10.0-3 from 10.0-4
|
||||
ALTER EXTENSION citus UPDATE TO '10.0-4';
|
||||
ALTER EXTENSION citus UPDATE TO '10.0-3';
|
||||
-- Should be empty result, even though the downgrade doesn't undo the upgrade, the
|
||||
-- function signature doesn't change, which is reflected here.
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
|
||||
-- Snapshot of state at 10.0-4
|
||||
ALTER EXTENSION citus UPDATE TO '10.0-4';
|
||||
SELECT * FROM print_extension_changes();
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
|
||||
DROP TABLE prev_objects, extension_diff;
|
||||
-- check that we depend on the existence of public schema, and we can not drop it now
|
||||
DROP SCHEMA public;
|
||||
|
||||
-- verify that citus_tables view is on pg_catalog if public schema is absent.
|
||||
ALTER EXTENSION citus UPDATE TO '9.5-1';
|
||||
DROP SCHEMA public;
|
||||
ALTER EXTENSION citus UPDATE TO '10.0-4';
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
|
||||
-- recreate public schema, and recreate citus_tables in the public schema by default
|
||||
CREATE SCHEMA public;
|
||||
GRANT ALL ON SCHEMA public TO public;
|
||||
ALTER EXTENSION citus UPDATE TO '9.5-1';
|
||||
ALTER EXTENSION citus UPDATE TO '10.0-4';
|
||||
SELECT * FROM multi_extension.print_extension_changes();
|
||||
|
||||
DROP TABLE multi_extension.prev_objects, multi_extension.extension_diff;
|
||||
|
||||
-- show running version
|
||||
SHOW citus.version;
|
||||
|
@ -525,3 +515,4 @@ FROM test.maintenance_worker();
|
|||
SELECT count(*) FROM pg_stat_activity WHERE application_name = 'Citus Maintenance Daemon';
|
||||
|
||||
DROP TABLE version_mismatch_table;
|
||||
DROP SCHEMA multi_extension;
|
||||
|
|
Loading…
Reference in New Issue