[postgis-tickets] r17745 - run_test.pl: always repackage raster when upgrading via function

Sandro Santilli strk at kbt.io
Tue Aug 20 12:29:09 PDT 2019


Author: strk
Date: 2019-08-20 12:29:09 -0700 (Tue, 20 Aug 2019)
New Revision: 17745

Modified:
   trunk/regress/run_test.pl
Log:
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

Modified: trunk/regress/run_test.pl
===================================================================
--- trunk/regress/run_test.pl	2019-08-20 18:33:34 UTC (rev 17744)
+++ trunk/regress/run_test.pl	2019-08-20 19:29:09 UTC (rev 17745)
@@ -1551,17 +1551,12 @@
       die;
     }
 
-    if ( $upgrade_via_function )
+    # 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) )
     {
-      # The function does everything
-      return 1;
-    }
-
-    if ( $OPT_WITH_RASTER )
-    {
-      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 @@
       }
       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,8 +1595,32 @@
           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 )
     {
       my $sql = "ALTER EXTENSION postgis_topology UPDATE TO '${nextver}'";



More information about the postgis-tickets mailing list