From: Sandro Santilli Date: Sun, 23 Feb 2014 15:42:43 +0000 (+0000) Subject: Add support for --extension --upgrade in run_test.pl X-Git-Tag: 2.2.0rc1~1236 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9f37afb87ee3df2abf8aa8de549ccdbd181c4e63;p=postgis Add support for --extension --upgrade in run_test.pl git-svn-id: http://svn.osgeo.org/postgis/trunk@12257 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/regress/run_test.pl b/regress/run_test.pl index d903447e1..866f9e455 100755 --- a/regress/run_test.pl +++ b/regress/run_test.pl @@ -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;