Ivan Sergio Borgonovo wrote:
> I just learned there is a "return all row" mode for returning set
> There are currently two modes in which a function can return a set
> result: value-per-call, or materialize. In value-per-call mode, the
> function returns one value each time it is called, and finally
> reports "done" when it has no more values to return. In materialize
> mode, the function's output set is instantiated in a Tuplestore
> object; all the values are returned in one call. Additional modes
> might be added in future"
> There is no example of a function working in this mode.
> I'd guess it should be suited for quick operation and small return.
> But... what should be considered quick and small?
> When someone should use a "row at a time" function and a "return all
> row" function?
There are quite a few SRF functions in the code. Look for example in
contrib/hstore/hstore_op.c for some fairly simple examples.
SRFs are quite capable of returning huge resultsets, not just small
ones. Example code for matrerialize mode can be found in the PLs among
other places (e.g. plperl_return_next() )
In response to
pgsql-hackers by date
|Next:||From: Ivan Sergio Borgonovo||Date: 2010-01-27 15:17:24|
|Subject: Re: C function accepting/returning cstring vs. text|
|Previous:||From: Peter Eisentraut||Date: 2010-01-27 14:52:00|
|Subject: Re: [COMMITTERS] pgsql: Remove tabs in SGML.|