Re: [HACKERS] strange bug in plperl

2004-07-09 Thread ggray
Atached patch fix the problem. Serg Andrew Dunstan wrote: Can anyone suggest why I might be seeing this effect (each notice comes out once per row plus once per function call) thanks andrew andrew=# create function tstset() returns setof tst language plperl as $$ andrew$# elog(NOTICE,"tstset call

Re: [HACKERS] strange bug in plperl

2004-07-05 Thread elein
I just reproduced this problem when returning a composite and NOT as SETOF composite. An assumption is being made that if the return value is a composite, that it must be part of a set. This is incorrect. Test case available on request--if you don't have one already. Spoke with Andrew wrt on #po

Re: [HACKERS] strange bug in plperl

2004-07-05 Thread Andrew Dunstan
Tom Lane wrote: Andrew Dunstan <[EMAIL PROTECTED]> writes: Can anyone suggest why I might be seeing this effect (each notice comes out once per row plus once per function call) It looks like you're executing the whole function body once per physical call, which is certainly not a good pla

Re: [HACKERS] strange bug in plperl

2004-07-05 Thread Tom Lane
Andrew Dunstan <[EMAIL PROTECTED]> writes: > Can anyone suggest why I might be seeing this effect (each notice comes > out once per row plus once per function call) It looks like you're executing the whole function body once per physical call, which is certainly not a good plan for a function ret

Re: [HACKERS] strange bug in plperl

2004-07-05 Thread Andrew Dunstan
OK, thanks. I see where the problem is. We'll fix the SRF code. cheers andrew Darko Prenosil wrote: Because that is exactly count of "tstset" function being called. Set returning functions are called recursively until SRF_RETURN_DONE is returned, and that in You case means until last row is fetch

Re: [HACKERS] strange bug in plperl

2004-07-05 Thread Darko Prenosil
Because that is exactly count of "tstset" function being called. Set returning functions are called recursively until SRF_RETURN_DONE is returned, and that in You case means until last row is fetched. When You programming functions in "C", there is SRF_ISFIRST_CALL function that returns "true"

[HACKERS] strange bug in plperl

2004-07-05 Thread Andrew Dunstan
Can anyone suggest why I might be seeing this effect (each notice comes out once per row plus once per function call) thanks andrew andrew=# create function tstset() returns setof tst language plperl as $$ andrew$# elog(NOTICE,"tstset called"); andrew$# return [{i=>1,v=>"one"},{i=>2,v=>"two"}]; a