Re: SRF in SFRM_ValuePerCall mode

From: "dv (at) nabble" <dvnabble(at)gmail(dot)com>
To: "Heikki Linnakangas" <heikki(at)enterprisedb(dot)com>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-hackers list" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: SRF in SFRM_ValuePerCall mode
Date: 2008-04-29 09:40:53
Message-ID: 32D310430D0E494FBDF9029B644F61F8@dvhome
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

----- Original Message -----
From: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Heikki Linnakangas" <heikki(at)enterprisedb(dot)com>
Cc: "dv @ nabble" <dvnabble(at)gmail(dot)com>; "pgsql-hackers list"
<pgsql-hackers(at)postgresql(dot)org>
Sent: Monday, April 28, 2008 5:07 PM
Subject: Re: [HACKERS] SRF in SFRM_ValuePerCall mode

> "Heikki Linnakangas" <heikki(at)enterprisedb(dot)com> writes:
>> dv @ nabble wrote:
>>> I am working on implementation of custom "C" SRF for our team. The SRF
>>> uses
>>> SFRM_ValuePerCall mode. I know that sometimes even in SFRM_ValuePerCall
>>> mode
>>> all the rows returned from SRF are "materialized" (for performing JOINs,
>>> for
>>> example).
>
>> Yep, they are unfortunately always materialized. Back when set returning
>> functions were implemented, the original patch did actually support true
>> "value per call" mode, where the whole result set was not materialized.
>> However, it was dropped because of some issues I can't remember off the
>> top of my head. The value-per-call API was committed, so that it was
>> already in place when someone gets around to implement the backend
>> support for it.
>
> That's a rather revisionist view of history ;-) Value-per-call mode has
> always been there, just not in nodeFunctionscan.c.
>
> If you're not joining to the function result, and you don't need the
> ability to determine its result type on the fly, you could declare it
> as returning a specific rowtype and then call it in the targetlist:
>
> select vpc();

You mean make the function return the only row?
This is not the functionality we need. What we want is to create a SETOF
function that will
emulate a table and query this "table" with WHERE filter and LIMIT clauses
to limit the row
count we want to return. We might pass the filter and the limit to the
function, but we want to
implement it in more natural way.

Thanks,
Denis

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Mueller 2008-04-29 11:37:37 Re: Protection from SQL injection
Previous Message Gregory Stark 2008-04-29 09:11:39 Re: [SPAM] Re: Proposed patch - psql wraps at window width