Re: [GENERAL] C-language functions: SRF question

2010-04-13 Thread Tom Lane
Jorge Arevalo writes: > BTW, this code is for WKT Raster. A PostGIS extension. We can use the > memory context I said (fcinfo->flinfo->fn_mcxt) to allocate memory > when we need to call one of our functions from a standard "version 1" > function, but is this the right context? I mean, the context

Re: [GENERAL] C-language functions: SRF question

2010-04-08 Thread Jorge Arevalo
On Thu, Apr 8, 2010 at 6:18 PM, Merlin Moncure wrote: > On Thu, Apr 8, 2010 at 11:40 AM, Jorge Arevalo > wrote: >> Is this a good way of doing it? Is it possible? And another small >> question: if the memory for my array of structs is allocated inside >> the function that provides me the array, s

Re: [GENERAL] C-language functions: SRF question

2010-04-08 Thread Merlin Moncure
On Thu, Apr 8, 2010 at 11:40 AM, Jorge Arevalo wrote: > Is this a good way of doing it? Is it possible? And another small > question: if the memory for my array of structs is allocated inside > the function that provides me the array, should I deallocate it in the > SRF? Using pfree? It wasn't all

[GENERAL] C-language functions: SRF question

2010-04-08 Thread Jorge Arevalo
Hello, I need to code a set-returning function, but it's my first time, and I'm not sure if my point is the right one. I'd like to know your opinion: My function will return an array of structs. Then, In the first call (SRF_IS_FIRSTCALL() is true), I get the array from another function. For the n