From 351b3396d5284ddd384b17d91d6c26f555c2d56e Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Tue, 20 Aug 2019 19:29:09 +0000 Subject: [PATCH] run_test.pl: always repackage raster when upgrading via function This is because the upgrade function invoked may be coming from the a pre-split version and thus not know anything about repackaging. See #4485 git-svn-id: http://svn.osgeo.org/postgis/trunk@17745 b70326c6-7e19-0410-871a-916f4a2858ee --- regress/run_test.pl | 64 ++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 33 deletions(-) diff --git a/regress/run_test.pl b/regress/run_test.pl index faf819613..d4cf721b6 100755 --- a/regress/run_test.pl +++ b/regress/run_test.pl @@ -1551,17 +1551,12 @@ sub upgrade_spatial_extensions die; } - if ( $upgrade_via_function ) - { - # The function does everything - return 1; - } - - if ( $OPT_WITH_RASTER ) + # Handle raster split if coming from pre-split and going + # to splitted raster + if ( $OPT_UPGRADE_FROM && has_split_raster_ext($OPT_UPGRADE_TO) && + ! has_split_raster_ext($OPT_UPGRADE_FROM) ) { - if ( $OPT_UPGRADE_FROM - && ! has_split_raster_ext($OPT_UPGRADE_FROM) - ) + if ( $OPT_WITH_RASTER ) { # upgrade of postgis must have unpackaged raster, so # we create it again here @@ -1578,29 +1573,8 @@ sub upgrade_spatial_extensions } else { - my $sql = "ALTER EXTENSION postgis_raster UPDATE TO '${nextver}'"; - - if ( $OPT_UPGRADE_FROM =~ /^unpackaged/ ) { - $sql = "CREATE EXTENSION postgis_raster VERSION '${nextver}' FROM unpackaged"; - } - - print "Upgrading PostGIS Raster in '${DB}' using: ${sql}\n" ; - - my $cmd = "psql $psql_opts -c \"" . $sql . "\" $DB >> $REGRESS_LOG 2>&1"; - my $rv = system($cmd); - if ( $rv ) { - fail "Error encountered altering EXTENSION POSTGIS_RASTER", $REGRESS_LOG; - die; - } - } - } - else - { - # Raster support was not requested, so drop it if - # left unpackaged - if ( $OPT_UPGRADE_FROM - && ! has_split_raster_ext($OPT_UPGRADE_FROM) ) - { + # Raster support was not requested, so drop it if + # left unpackaged print "Packaging PostGIS Raster in '${DB}' for later drop using: ${sql}\n" ; $sql = "CREATE EXTENSION postgis_raster VERSION '${nextver}' FROM unpackaged"; @@ -1621,6 +1595,30 @@ sub upgrade_spatial_extensions die; } } + } + + if ( $upgrade_via_function ) + { + # The function does everything + return 1; + } + + if ( $OPT_WITH_RASTER ) + { + my $sql = "ALTER EXTENSION postgis_raster UPDATE TO '${nextver}'"; + + if ( $OPT_UPGRADE_FROM =~ /^unpackaged/ ) { + $sql = "CREATE EXTENSION postgis_raster VERSION '${nextver}' FROM unpackaged"; + } + + print "Upgrading PostGIS Raster in '${DB}' using: ${sql}\n" ; + + my $cmd = "psql $psql_opts -c \"" . $sql . "\" $DB >> $REGRESS_LOG 2>&1"; + my $rv = system($cmd); + if ( $rv ) { + fail "Error encountered altering EXTENSION POSTGIS_RASTER", $REGRESS_LOG; + die; + } } if ( $OPT_WITH_TOPO ) -- 2.40.0