]> granicus.if.org Git - postgis/commitdiff
Add support for --extension --upgrade in run_test.pl
authorSandro Santilli <strk@keybit.net>
Sun, 23 Feb 2014 15:42:43 +0000 (15:42 +0000)
committerSandro Santilli <strk@keybit.net>
Sun, 23 Feb 2014 15:42:43 +0000 (15:42 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@12257 b70326c6-7e19-0410-871a-916f4a2858ee

regress/run_test.pl

index d903447e10ffad693819228169d72511ff628767..866f9e455dc6467889d545ae73f673e6fcfa921b 100755 (executable)
@@ -1199,6 +1199,29 @@ sub upgrade_spatial
     return 1;
 }
 
+# Upgrade an existing database (soft upgrade, extension method)
+sub upgrade_spatial_extension
+{
+    print "Upgrading PostGIS in '${DB}' using 'ALTER EXTENSION'\n" ;
+
+    # ON_ERROR_STOP is used by psql to return non-0 on an error
+    my $psql_opts = "--no-psqlrc --variable ON_ERROR_STOP=true";
+    my $cmd = "psql $psql_opts -c \"ALTER EXTENSION postgis UPGRADE TO ${libver}next\" $DB >> $REGRESS_LOG 2>&1";
+    my $rv = system($cmd);
+    die "\nError encountered altering EXTENSION POSTGIS, see $REGRESS_LOG for details\n\n"
+           if $rv;
+
+    if ( $OPT_WITH_TOPO ) 
+    {
+      my $cmd = "psql $psql_opts -c \"ALTER EXTENSION postgis_topology UPGRADE TO ${libver}next\" $DB >> $REGRESS_LOG 2>&1";
+      my $rv = system($cmd);
+      die "\nError encountered altering EXTENSION POSTGIS_TOPOLOGY, see $REGRESS_LOG for details\n\n"
+        if $rv;
+    }
+    
+    return 1;
+}
+
 sub drop_spatial
 {
        my $ok = 1;