Re: C function accepting/returning cstring vs. text

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Ivan Sergio Borgonovo <mail(at)webthatworks(dot)it>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: C function accepting/returning cstring vs. text
Date: 2010-01-27 15:10:01
Message-ID: 4B605749.4070000@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ivan Sergio Borgonovo 2010-01-27 15:17:24 Re: C function accepting/returning cstring vs. text
Previous Message Peter Eisentraut 2010-01-27 14:52:00 Re: [COMMITTERS] pgsql: Remove tabs in SGML.