commit 1101b263ceb0009b495706e25b7aad569e2f78ce Author: Anton A. Melnikov Date: Fri Jun 3 23:50:14 2022 +0300 Fix test for pg_upgrade from 10x adn earlier versions. diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl index 2f9b13bf0a..1fd1b6f028 100644 --- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl +++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl @@ -60,7 +60,14 @@ my $oldnode = # To increase coverage of non-standard segment size and group access without # increasing test runtime, run these tests with a custom setting. # --allow-group-access and --wal-segsize have been added in v11. -$oldnode->init(extra => [ '--wal-segsize', '1', '--allow-group-access' ]); +my $ver_with_newopts = 11; +my $oldver = $oldnode->{_pg_version}; + +$oldnode->init(extra => [ '--wal-segsize', '1', '--allow-group-access' ]) + if $oldver >= $ver_with_newopts; +$oldnode->init() + if $oldver < $ver_with_newopts; + $oldnode->start; # The default location of the source code is the root of this directory. @@ -147,7 +154,10 @@ if (defined($ENV{oldinstall})) # Initialize a new node for the upgrade. my $newnode = PostgreSQL::Test::Cluster->new('new_node'); -$newnode->init(extra => [ '--wal-segsize', '1', '--allow-group-access' ]); +$newnode->init(extra => [ '--wal-segsize', '1', '--allow-group-access' ]) + if $oldver >= $ver_with_newopts; +$newnode->init() + if $oldver < $ver_with_newopts; my $newbindir = $newnode->config_data('--bindir'); my $oldbindir = $oldnode->config_data('--bindir'); diff --git a/src/bin/pg_upgrade/upgrade_adapt.sql b/src/bin/pg_upgrade/upgrade_adapt.sql index 27c4c7fd01..d47d2075f5 100644 --- a/src/bin/pg_upgrade/upgrade_adapt.sql +++ b/src/bin/pg_upgrade/upgrade_adapt.sql @@ -84,8 +84,8 @@ DO $stmt$ \if :oldpgversion_le13 -- Until v10, operators could only be dropped one at a time, so be careful -- to stick with one command for each drop here. -DROP OPERATOR public.#@# (pg_catalog.int8, NONE); -DROP OPERATOR public.#%# (pg_catalog.int8, NONE); -DROP OPERATOR public.!=- (pg_catalog.int8, NONE); -DROP OPERATOR public.#@%# (pg_catalog.int8, NONE); +DROP OPERATOR IF EXISTS public.#@# (pg_catalog.int8, NONE); +DROP OPERATOR IF EXISTS public.#%# (pg_catalog.int8, NONE); +DROP OPERATOR IF EXISTS public.!=- (pg_catalog.int8, NONE); +DROP OPERATOR IF EXISTS public.#@%# (pg_catalog.int8, NONE); \endif