1
0
mirror of https://github.com/postgres/postgres.git synced 2025-05-02 11:44:50 +03:00

Improve logic in PostgresVersion.pm

Handle the situation where perl swaps the order of operands of
the comparison operator. See `perldoc overload` for details:

The third argument is set to TRUE if (and only if) the two
operands have been swapped. Perl may do this to ensure that the
first argument ($self) is an object implementing the overloaded
operation, in line with general object calling conventions.
This commit is contained in:
Andrew Dunstan 2021-04-27 08:21:15 -04:00
parent 0c8f40863a
commit fa26eba221
No known key found for this signature in database
GPG Key ID: 99FA7FCB59FC3B81

View File

@ -110,10 +110,12 @@ sub new
#
sub _version_cmp
{
my ($a, $b) = @_;
my ($a, $b, $swapped) = @_;
$b = __PACKAGE__->new($b) unless blessed($b);
($a, $b) = ($b, $a) if $swapped;
my ($an, $bn) = ($a->{num}, $b->{num});
for (my $idx = 0;; $idx++)