Skip to content

Commit a4a1d23

Browse files
uuDavid Christensen
authored andcommitted
Support new_version_pg for PG10.
1 parent e3409de commit a4a1d23

File tree

1 file changed

+33
-5
lines changed

1 file changed

+33
-5
lines changed

check_postgres.pl

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5775,9 +5775,19 @@ sub find_new_version {
57755775
my $exec = shift or die;
57765776
my $url = shift or die;
57775777

5778+
5779+
my $version = verify_version();
5780+
57785781
## The format is X.Y.Z [optional message]
57795782
my $versionre = qr{((\d+)\.(\d+)\.(\d+))\s*(.*)};
57805783
my ($cversion,$cmajor,$cminor,$crevision,$cmessage) = ('','','','','');
5784+
5785+
## If we're running on PG10, then format is X.Y [optional message]
5786+
if ($version >= 10) {
5787+
$versionre = qr{((\d+)\.(\d+))\s*(.*)};
5788+
($cversion,$cmajor,$cminor,$cmessage) = ('','','','');
5789+
}
5790+
57815791
my $found = 0;
57825792

57835793
## Try to fetch the current version from the web
@@ -5789,9 +5799,17 @@ sub find_new_version {
57895799
## Postgres is slightly different
57905800
if ($program eq 'Postgres') {
57915801
$cmajor = {};
5792-
while ($info =~ /<title>(\d+)\.(\d+)\.(\d+)/g) {
5793-
$found = 1;
5794-
$cmajor->{"$1.$2"} = $3;
5802+
if ($version >= 10) {
5803+
while ($info =~ /<title>(\d+)\.(\d+)/g) {
5804+
$found = 1;
5805+
$cmajor->{"$1"} = $2;
5806+
}
5807+
}
5808+
else {
5809+
while ($info =~ /<title>(\d+)\.(\d+)\.(\d+)/g) {
5810+
$found = 1;
5811+
$cmajor->{"$1.$2"} = $3;
5812+
}
57955813
}
57965814
}
57975815
elsif ($info =~ $versionre) {
@@ -5835,7 +5853,13 @@ sub find_new_version {
58355853
add_unknown msg('new-ver-nolver', $program);
58365854
return;
58375855
}
5838-
my ($lversion,$lmajor,$lminor,$lrevision) = ($1, int $2, int $3, int $4);
5856+
my ($lversion,$lmajor,$lminor,$lrevision) = ('',0,0,0);
5857+
if ($version >= 10) {
5858+
($lversion, $lmajor, $lminor) = ($1, int $2, int $3);
5859+
} else {
5860+
($lversion,$lmajor,$lminor,$lrevision) = ($1, int $2, int $3, int $4);
5861+
}
5862+
58395863
if ($VERBOSE >= 1) {
58405864
$output =~ s/\s+$//s;
58415865
warn "Local version string: $output\n";
@@ -5852,7 +5876,11 @@ sub find_new_version {
58525876
$crevision = $cmajor->{$lver};
58535877
$cmajor = $lmajor;
58545878
$cminor = $lminor;
5855-
$cversion = "$cmajor.$cminor.$crevision";
5879+
if ($version >= 10) {
5880+
$cversion = "$cmajor.$cminor";
5881+
} else {
5882+
$cversion = "$cmajor.$cminor.$crevision";
5883+
}
58565884
}
58575885

58585886
## Most common case: everything matches

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy