Re: [GENERAL] Writing SRF

2010-04-30 Thread Jorge Arevalo
e sert à l'information seulement et n'aura > pas n'importe quel effet légalement obligatoire. Étant donné que les email > peuvent facilement être sujets à la manipulation, nous ne pouvons accepter > aucune responsabilité pour le contenu fourni. > > > > >> F

Re: [GENERAL] Writing SRF

2010-04-30 Thread Jorge Arevalo
On Thu, Apr 29, 2010 at 8:03 PM, Tom Lane wrote: > Jorge Arevalo writes: >> Many thanks! That was one of my errors. Another one was this: > >> char szDataPointer[10]; >> sprintf(szDataPointer, "%p", a_pointer); > >> These lines caused a memory error. > > That looks all right in itself (unless you

Re: [GENERAL] Writing SRF

2010-04-29 Thread Martin Gainty
Thu, 29 Apr 2010 19:45:41 +0200 > Subject: Re: [GENERAL] Writing SRF > To: t...@sss.pgh.pa.us > CC: pgsql-general@postgresql.org > > On Thu, Apr 29, 2010 at 3:56 PM, Tom Lane wrote: > > Jorge Arevalo writes: > >> Yes. For example, the function expects 2 arguments, an

Re: [GENERAL] Writing SRF

2010-04-29 Thread Tom Lane
Jorge Arevalo writes: > Many thanks! That was one of my errors. Another one was this: > char szDataPointer[10]; > sprintf(szDataPointer, "%p", a_pointer); > These lines caused a memory error. That looks all right in itself (unless you're on a 64-bit machine, in which case you need a bigger arra

Re: [GENERAL] Writing SRF

2010-04-29 Thread Jorge Arevalo
On Thu, Apr 29, 2010 at 3:56 PM, Tom Lane wrote: > Jorge Arevalo writes: >> Yes. For example, the function expects 2 arguments, and it's called >> with 2 arguments: 1 composite type (following this format >> https://svn.osgeo.org/postgis/spike/wktraster/doc/RFC1-SerializedFormat) >> and one integ

Re: [GENERAL] Writing SRF

2010-04-29 Thread Tom Lane
Jorge Arevalo writes: > Yes. For example, the function expects 2 arguments, and it's called > with 2 arguments: 1 composite type (following this format > https://svn.osgeo.org/postgis/spike/wktraster/doc/RFC1-SerializedFormat) > and one integer. But PG_NARGS() returns a really big value (16297) >

Re: [GENERAL] Writing SRF

2010-04-29 Thread Jorge Arevalo
On Wed, Apr 28, 2010 at 10:43 PM, Tom Lane wrote: > Jorge Arevalo writes: >> My doubt is if I'm doing things right getting all the stuff I need (an >> array) in the first call, pointing user_fctx to this array and >> accessing myStructsArray[call_cntr] in each successive call, until >> myStructsA

Re: [GENERAL] Writing SRF

2010-04-28 Thread Tom Lane
Jorge Arevalo writes: > My doubt is if I'm doing things right getting all the stuff I need (an > array) in the first call, pointing user_fctx to this array and > accessing myStructsArray[call_cntr] in each successive call, until > myStructsArray + call_cntr == NULL (last array element?). Sounds r

Re: [GENERAL] Writing SRF

2010-04-28 Thread Jorge Arevalo
On Wed, Apr 28, 2010 at 7:00 PM, Tom Lane wrote: > Jorge Arevalo writes: >> 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 re

Re: [GENERAL] Writing SRF

2010-04-28 Thread Tom Lane
Jorge Arevalo writes: > 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 i

[GENERAL] Writing SRF

2010-04-28 Thread Jorge Arevalo
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,