Writing SRF

Поиск
Список
Период
Сортировка
От Jorge Arevalo
Тема Writing SRF
Дата
Msg-id t2ld321138e1004280926n703e7379t7508b5f19402d815@mail.gmail.com
обсуждение исходный текст
Ответы Re: Writing SRF  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
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

В списке pgsql-general по дате отправления:

Предыдущее
От: Jasen Betts
Дата:
Сообщение: Re: [SPAM] Re: Best way to replicate to large number of nodes
Следующее
От: sunpeng
Дата:
Сообщение: only one namespace allowed by a authid at pg_namespace table?