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

Re: plperl & sort

From: Jeff <threshar(at)torgo(dot)978(dot)org>
To: Alex Hunsaker <badalex(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: plperl & sort
Date: 2008-11-04 20:51:27
Message-ID: 45A1A6B4-4BAD-4394-9F31-F477A8F1FCE3@torgo.978.org (view raw or flat)
Thread:
Lists: pgsql-bugs
On Nov 4, 2008, at 2:27 PM, Alex Hunsaker wrote:

> 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()
>


I came across this because I was attempting to sort some data (an  
array of hashrefs) in to reverse order and got very odd results.. some  
elogging showed $a and $b were not what they should have been and  
after more and more digging I was able to widdle it down to the simple  
case I posted.  When I tried having it call a sub instead of an  
anonymous block it would complain the sub didn't exist. (I have other  
plperl functions that have subs declared and they all work fine, but I  
never used them with sort before).

I'll have some more time to tinker with it tomorrow. I'm reasonably  
sure its got something to do with the Safe module and some magic-fu we  
may need.  Looking at plperl we do allow sort so I'm not sure why $a &  
$b disappear..

--
Jeff Trout <jeff(at)jefftrout(dot)com>
http://www.stuarthamm.net/
http://www.dellsmartexitin.com/




In response to

pgsql-bugs by date

Next:From: Andrew DunstanDate: 2008-11-04 21:43:05
Subject: Re: plperl & sort
Previous:From: Alex HunsakerDate: 2008-11-04 20:49:24
Subject: Re: plperl & sort

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