Re: plperl & sort

Поиск
Список
Период
Сортировка
От Jeff
Тема Re: plperl & sort
Дата
Msg-id 0398C703-6CF4-438A-810D-ACDBDAA7A146@torgo.978.org
обсуждение исходный текст
Ответ на Re: plperl & sort  (Andrew Dunstan <andrew@dunslane.net>)
Список pgsql-bugs
On Nov 4, 2008, at 4:43 PM, Andrew Dunstan wrote:

>
> OK, the first thing to note is that there is an easy workaround,
> which is to use a sort routine that doesn't need $a/$b. Example:
>
>   create or replace function mysort() returns text language plperl
> as $f$
>
>       my $sfunc = sub ($$) { $_[0] <=> $_[1] };
>
>       my @vals = (5,3,4,2,7);
>
>       return join(' ',sort $sfunc @vals);
>
>   $f$;
>

Andrew for the win!

Thanks a lot!

I agree, a documentation note would be fine for this rather doing all
sorts of complicated perl trickery.

--
Jeff Trout <jeff@jefftrout.com>
http://www.stuarthamm.net/
http://www.dellsmartexitin.com/

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

Предыдущее
От: "Hiroshi Saito"
Дата:
Сообщение: Re: [ODBC] Behavior change of FK info query
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #4510: memory leak with libpg.dll