Re: multi-install PostgresNode fails with older postgres versions

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Jehan-Guillaume de Rorthais <jgdr(at)dalibo(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: multi-install PostgresNode fails with older postgres versions
Date: 2021-04-22 16:42:33
Message-ID: 3367358f-f4ea-a0b7-12fb-f82f6cd3548a@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 4/22/21 11:46 AM, Mark Dilger wrote:
>
>> On Apr 22, 2021, at 8:09 AM, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> wrote:
>>
>>> + # Accept standard formats, in case caller has handed us the output of a
>>> + # postgres command line tool
>>> + $arg = $1
>>> + if ($arg =~ m/\(?PostgreSQL\)? (\d+(?:\.\d+)*(?:devel)?)/);
>>> +
>>> + # Split into an array
>>> + my @result = split(/\./, $arg);
>>> +
>>> + # Treat development versions as having a minor/micro version one less than
>>> + # the first released version of that branch.
>>> + if ($result[$#result] =~ m/^(\d+)devel$/)
>>> + {
>>> + pop(@result);
>>> + push(@result, $1, -1);
>>> + }
>> It's a bit weird to parse the "devel" bit twice. Would it work to leave
>> (?:devel)? out of the capturing parens that becomes $1 in the first
>> regex and make it capturing itself, so you get "devel" in $2, and decide
>> based on its presence/absence? Then you don't have to pop and push a -1.
> The first regex should match things like "12", "12.1", "14devel", or those same things prefixed with "(PostgreSQL) ", and strip off the "(PostgreSQL)" part if it exists. But the code should also BAIL_OUT if the regex completely fails to match.
>

Not quite. PostgresVersion doesn't know about Test::More. It could die
(or croak) and we could catch it in an eval.

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Joel Jacobson 2021-04-22 17:11:25 pg_identify_object_as_address() doesn't support pg_event_trigger oids
Previous Message Tom Stellard 2021-04-22 16:35:48 Re: Do we work with LLVM 12 on s390x?