Re: SRF written in C - Mailing list pgsql-general

From Felipe de Jesús Molina Bravo
Subject Re: SRF written in C
Date
Msg-id 1215008968.4372.15.camel@fjmb
Whole thread Raw
In response to Re: SRF written in C  (Martijn van Oosterhout <kleptog@svana.org>)
Responses Re: SRF written in C
List pgsql-general
El mié, 02-07-2008 a las 08:02 +0200, Martijn van Oosterhout escribió:
> On Tue, Jul 01, 2008 at 10:02:39AM -0500, Felipe de Jesús Molina Bravo wrote:
> > Hi
> >
> > what can i do for  a SRF written in C, can called as follow:
> >
> >   select * from obtAscendencia('(11099,15685)','(6808,9621)');
> >
> > I can call the function:
> >   select obtAscendencia('(11099,15685)','(6808,9621)');
>
> I'm afraid you did not explain what exactly the problem is. Do you mean
> that one or the other of the statements doesn't work? Which one, and
> what is the error message?
>
> Have a nice day,

ok... sorry

the next statement:
   select * from obtAscendencia('(11099,15685)','(6808,9621)');

never end .... i need to kill the process assigned for my statement...
and  the other statement:

   select obtAscendencia('(11099,15685)','(6808,9621)');

is  correct ... the output is:

 obtascendencia
----------------
 (4291, 6064)
 (1774, 2507)
 (1031, 1457)
 (288, 407)
 (121, 171)
 (75, 106)
 (29, 41)
 (12, 17)
 (7, 10)
 (2, 3)
(10 filas)

and my question is :

Why can not perform my function as the first statement?

I suspect that my error is:

        r = obtPadre( &intF->izq, &intF->der );
        if (  ( r->num != 1 ) &&
              ( r->den != 2 )   )
            {

                intF->der.num = intF->izq.num;
                intF->der.den = intF->izq.den;
                intF->izq.num = r->num;
                intF->izq.den = r->den;

                SRF_RETURN_NEXT(funcctx, (Datum)(r));
            }

Where "r" is type "Racional" (Rational)...



thanks in advance

see you

pgsql-general by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: pg crashing
Next
From: David Siebert
Date:
Subject: Postgres benchmark?