Re: Recursive calls to functions that return sets

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Martijn van Oosterhout <kleptog(at)svana(dot)org>, Thomas Hallgren <thomas(at)tada(dot)se>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Recursive calls to functions that return sets
Date: 2006-03-22 17:15:49
Message-ID: 44218645.2080602@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:

>
>plpgsql and similar languages will return a tuplestore anyway, so it has
>to handle that case, and it was convenient to make all the cases look
>alike for starters. Nobody's yet gone back to improve it for the case
>of languages that return a tuple per call.
>
>
>

This would be hard to do in the plperl case, at least, and I would be
surprised if it weren't in most others too. So what plperl does is to
fetch the whole set on the first call and then fudges all the other
calls to get the next element from the result set. We save out the
intermediate tuple store on each call and restore it afterwards, so I
think recursion shouldn't be a difficulty.

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Adrian Maier 2006-03-22 17:22:50 Re: How to put back??
Previous Message Tom Lane 2006-03-22 17:05:28 Re: Recursive calls to functions that return sets