Hello,
I'm writing a SRF following the example from
http://www.postgresql.org/docs/8.4/interactive/xfunc-c.html (section
34.9.10). In the example, in the code executed in first call, we get
the number of tuples to be returned, and no more. Then, in each call,
a new tuple is allocated and returned, until reach max_calls.
My problem is I want to return an array of structs, and that array is
returned (as a pointer) by an external function. I can call that
funcion in first call, and then store a the returned array in
funcctx->user_fctx. In successive calls, I can get one new element of
the array pointed by user_fctx, but I'd need the number of elements
(the classical problem "how to get the number of elements of a
dinamically allocated array").
Would the best way to modify the external function to get, somehow,
the number of structs returned? Is there any better way to do what I
need?
Thanks in advance, and best regards
Jorge
----
http://www.gis4free.org/blog