Re: plperl & sort

From: Jeff <threshar(at)torgo(dot)978(dot)org>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Alex Hunsaker <badalex(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Jeff <threshar(at)threshar(dot)is-a-geek(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: plperl & sort
Date: 2008-11-05 14:16:26
Message-ID: 0398C703-6CF4-438A-810D-ACDBDAA7A146@torgo.978.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)jefftrout(dot)com>
http://www.stuarthamm.net/
http://www.dellsmartexitin.com/

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2008-11-05 15:33:16 Re: BUG #4510: memory leak with libpg.dll
Previous Message Hiroshi Saito 2008-11-05 14:06:10 Re: [ODBC] Behavior change of FK info query