Re: buildfarm's typedefs list has gone completely nutso

Поиск
Список
Период
Сортировка
От Daniel Gustafsson
Тема Re: buildfarm's typedefs list has gone completely nutso
Дата
Msg-id 463E2D77-AE12-440A-B534-C5E8CEF55D42@yesql.se
обсуждение исходный текст
Ответ на Re: buildfarm's typedefs list has gone completely nutso  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: buildfarm's typedefs list has gone completely nutso  (Andrew Dunstan <andrew.dunstan@2ndquadrant.com>)
Список pgsql-hackers
> On 18 Jul 2019, at 17:42, Tom Lane <tgl@sss.pgh.pa.us> wrote:

>     return
>       if (exists $oconf->{dow}
>         && grep { $_ eq $wday } @{ $oconf->{dow} });
>
> I'm the world's worst Perl programmer, but isn't that backwards?
> It seems like it will return undef if today matches any entry
> of the dow list, making dow a blacklist of weekdays *not* to run
> the step on.

As it’s in a scalar context, grep will return the number of times for which the
condition is true against the list entries, so if $oconf->{dow} doesn’t have
duplicates it will return 1 if $wday is found on the list.  This will in turn
make the condition true as the exists expression must be true for grep to at
all execute.

cheers ./daniel


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: buildfarm's typedefs list has gone completely nutso
Следующее
От: Tom Lane
Дата:
Сообщение: Re: buildfarm's typedefs list has gone completely nutso