Re: C function accepting/returning cstring vs. text - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: C function accepting/returning cstring vs. text
Date
Msg-id 4B605749.4070000@dunslane.net
Whole thread Raw
In response to Re: C function accepting/returning cstring vs. text  (Ivan Sergio Borgonovo <mail@webthatworks.it>)
Responses Re: C function accepting/returning cstring vs. text  (Ivan Sergio Borgonovo <mail@webthatworks.it>)
List pgsql-hackers

Ivan Sergio Borgonovo wrote:
> I just learned there is a "return all row" mode for returning set
> functions:
> "
> 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() )

cheers

andrew


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: [COMMITTERS] pgsql: Remove tabs in SGML.
Next
From: Ivan Sergio Borgonovo
Date:
Subject: Re: C function accepting/returning cstring vs. text