From: | Jorge Arevalo <jorgearevalo(at)gis4free(dot)org> |
---|---|
To: | PostgreSQL - General <pgsql-general(at)postgresql(dot)org> |
Subject: | Writing SRF |
Date: | 2010-04-28 16:26:02 |
Message-ID: | t2ld321138e1004280926n703e7379t7508b5f19402d815@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | sunpeng | 2010-04-28 16:43:28 | only one namespace allowed by a authid at pg_namespace table? |
Previous Message | Scott Mead | 2010-04-28 14:37:55 | Re: pg_hba.conf |