Re: RETURN QUERY in PL/PgSQL?

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Neil Conway <neilc(at)samurai(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: RETURN QUERY in PL/PgSQL?
Date: 2007-04-23 22:05:19
Message-ID: 462D2D9F.2020603@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> Neil Conway <neilc(at)samurai(dot)com> writes:
>
>> This works, but it seems overly verbose. It occurred to me that we could
>> easily add a new PL/PgSQL statement that evaluates a set-returning
>> expression and adds *all* the resulting rows to the function's result
>> set. For example:
>>
>
> I think we've got something isomorphic to that in the patch queue
> already --- take a look at Pavel's "table function" patch. It's in
> need of cleanup but I think it will make it in.
>
>
>

Interesting - I haven't followed that one. In pl/perl the equivalent
will use one tuplestore on the way in and another on the way out, with
return_next() copying between the two. If we had some mechanism like
this there is thus a potential for substantial savings, as well as
improved clarity.

cheers

andrew

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Neil Conway 2007-04-23 22:05:59 Re: Improving deadlock error messages
Previous Message usleepless 2007-04-23 22:03:59 Re: Wild idea: 9.0?