]> granicus.if.org Git - postgis/commitdiff
Force load of target shared object before major version check
authorSandro Santilli <strk@keybit.net>
Tue, 24 Jun 2014 15:12:48 +0000 (15:12 +0000)
committerSandro Santilli <strk@keybit.net>
Tue, 24 Jun 2014 15:12:48 +0000 (15:12 +0000)
The load tries to ensure it's the load of the _old_ library that fails,
rather than the one of the _new_ library.

A failed load of the old library would make major version check resort
to call the postgis_scripts_installed() which would contain the correct
version since version 1.1.0 up. Load of the old library should only fail
when the old library is 2.1.0 up so there's no problem there.

NOTE: Failure of loading the _new_ library could still happen if the upgrade
script is loaded in a session in which the _old_ library was used already.
This is not something we can fix as there's no "unload" command in PostgreSQL.

Closes #2382

git-svn-id: http://svn.osgeo.org/postgis/trunk@12641 b70326c6-7e19-0410-871a-916f4a2858ee

utils/postgis_proc_upgrade.pl

index 31ba9134f41caefd0069fafc21b1e2ea9f20910e..366d4b1e878bd6ef9721a3ea8eddf95edf234a98 100755 (executable)
@@ -139,6 +139,7 @@ die "Usage: perl postgis_proc_upgrade.pl <postgis.sql> <version_from> [<schema>]
 
 my $sql_file = $ARGV[0];
 my $module = 'postgis';
+my $soname = '';
 my $version_to = "";
 my $version_to_num = 0;
 my $version_from = $ARGV[1];
@@ -168,6 +169,10 @@ while(<INPUT>)
        {
         $module = 'postgis_raster';
        }
+       elsif (m@('\$libdir/[^']*')@)
+       {
+        $soname = $1;
+       }
 }
 close(INPUT); 
 
@@ -191,6 +196,8 @@ print qq{
 
 };
 
+print "LOAD $soname;\n" if ($soname);
+
 print "BEGIN;\n";
 print "SET search_path TO $schema;\n" if $schema;