From: Greg Stark on
On Sat, Jan 23, 2010 at 12:56 PM, Ivan Sergio Borgonovo
<mail(a)webthatworks.it> wrote:
> And if I can... how, why and when... because I didn't find any clear
> example in the source tree that gives me a clue about when I'd use
> one form or the other.
>

There are a few contrib modules which make good examples, you could
look at contrib/pageinspect/heapfuncs.c:heap_page_items() for
example.



--
greg

--
Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

From: Greg Stark on
On Sat, Jan 23, 2010 at 5:53 PM, Ivan Sergio Borgonovo
<mail(a)webthatworks.it> wrote:
> That confused me further since it seems a 3rd technique to return
> set of records.
>

The heapfuncs.c example uses get_call_result_type() to get the
tupledesc and calls heap_form_tuple() to construct the return value,
just like the docs describe. The extra code is because it's a
set-returning-function which has its own set of tricky things to do.


--
greg

--
Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers