Skip site navigation (1) Skip section navigation (2)

Re: plperl & sort

From: "Alex Hunsaker" <badalex(at)gmail(dot)com>
To: Jeff <threshar(at)torgo(dot)978(dot)org>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: plperl & sort
Date: 2008-11-04 19:27:01
Message-ID: 34d269d40811041127k45d05346jfcdd5228d964be34@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-bugs
On Tue, Nov 4, 2008 at 09:02, Jeff <threshar(at)torgo(dot)978(dot)org> wrote:
> I've ran into this interesting problem.
> It seems that while you can call sort() in a trusted plperl func you cannot
> access $a & $b which effectively makes it useless.

Hrm works for me if I take out the elog from sort()

create or replace function trustedsort()
returns int
as $$

my @arr = qw(5 4 3 2 1);

my @sorted = sort { $a <=> $b } @arr;

elog(NOTICE, join(' ', @sorted));

return 1;

$$
language 'plperl';

SELECT trustedsort();
NOTICE:  1 2 3 4 5
 trustedsort
-------------
           1
(1 row)

In response to

Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2008-11-04 19:39:06
Subject: Re: plperl & sort
Previous:From: Tom LaneDate: 2008-11-04 18:41:40
Subject: Re: plperl & sort

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group