Skip to content

Commit

Permalink
PG17 compatibility: fix pg16 to pg17 upgrade
Browse files Browse the repository at this point in the history
In citus_prepapre_upgrade(), don't drop any_value when upgrading from
PG16+, because PG16+ has its own any_value function. Attempting to do
so results in an error. When 16 becomes the minimum supported Postgres
version, the drop statements can be removed.
  • Loading branch information
colm-mchugh committed Dec 16, 2024
1 parent 1c39f95 commit 84710e9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ BEGIN
DROP AGGREGATE IF EXISTS array_cat_agg(anyarray);
DROP AGGREGATE IF EXISTS array_cat_agg(anycompatiblearray);

-- We should drop any_value because PG16 has its own any_value function
-- We should drop any_value because PG16+ has its own any_value function
-- We can remove this part when we drop support for PG16
DELETE FROM pg_depend WHERE
objid IN (SELECT oid FROM pg_proc WHERE proname = 'any_value' OR proname = 'any_value_agg') AND
refobjid IN (select oid from pg_extension where extname = 'citus');
DROP AGGREGATE IF EXISTS pg_catalog.any_value(anyelement);
DROP FUNCTION IF EXISTS pg_catalog.any_value_agg(anyelement, anyelement);
IF substring(current_Setting('server_version'), '\d+')::int < 16 THEN
DELETE FROM pg_depend WHERE
objid IN (SELECT oid FROM pg_proc WHERE proname = 'any_value' OR proname = 'any_value_agg') AND
refobjid IN (select oid from pg_extension where extname = 'citus');
DROP AGGREGATE IF EXISTS pg_catalog.any_value(anyelement);
DROP FUNCTION IF EXISTS pg_catalog.any_value_agg(anyelement, anyelement);
END IF;

--
-- Drop existing backup tables
Expand Down

0 comments on commit 84710e9

Please sign in to comment.