Correct PG version check for 10.0+
authorMike Rylander <mrylander@gmail.com>
Thu, 6 Jan 2022 22:11:48 +0000 (17:11 -0500)
committerMike Rylander <mrylander@gmail.com>
Mon, 10 Jan 2022 14:54:45 +0000 (09:54 -0500)
Evergreen's core search query sometimes needs an optimization fence
around part of the query that filters on record attributes.  This is
due to naive mis-estimation of how common certain combinations of
values will be in bibliographic data.  This fence is implemented only
on Postgres versions that have a particular system catalog table, so
Evergreen has to test the Postgres version.  This commit fixes the
query used for that test so that it works with Postgres versions
that have more than one digit in the major version number, such as
Postgres 10.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm

index c4e3455..6e51fce 100644 (file)
@@ -772,7 +772,7 @@ sub dynamic_filter_compile {
     $negate = $negate ? '!' : '';
 
     if (!$_pg_version) {
-        ($_pg_version = $e->json_query({from => ['version']})->[0]->{version}) =~ s/^.+?(\d\.\d).+$/$1/;
+        ($_pg_version = $e->json_query({from => ['version']})->[0]->{version}) =~ s/^.+?(\d+\.\d+).+$/$1/;
     }
 
     my $common = 0;