Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit97ee956

Browse files
committed
Fix version comparison in Version.pm
Version strings with unequal numbers of parts were being comparedincorrectly. We cure this by treating a missing part in the shorterversion as 0.per complaint from Jehan-Guillaume de Rorthais, but the fix is mine, nothis.Discussion:https://postgr.es/m/20220628225325.53d97b8d@karstBackpatch to release 14 where this code was introduced.
1 parent83eccb8 commit97ee956

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

‎src/test/perl/PostgreSQL/Version.pm

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,12 @@ sub _version_cmp
123123

124124
for (my$idx = 0;;$idx++)
125125
{
126-
return 0unless (defined$an->[$idx] &&defined$bn->[$idx]);
127-
return$an->[$idx]<=>$bn->[$idx]
128-
if ($an->[$idx]<=>$bn->[$idx]);
126+
return 0
127+
if ($idx >=@$an &&$idx >=@$bn);
128+
# treat a missing number as 0
129+
my ($anum,$bnum) = ($an->[$idx] || 0,$bn->[$idx] || 0);
130+
return$anum<=>$bnum
131+
if ($anum<=>$bnum);
129132
}
130133
}
131134

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp