Re: Why my C function is called twice? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Why my C function is called twice?
Date
Msg-id 11700.1197433558@sss.pgh.pa.us
Whole thread Raw
In response to Why my C function is called twice?  ("Billow Gao" <billowgy@gmail.com>)
List pgsql-hackers
"Billow Gao" <billowgy@gmail.com> writes:
> A very simple C function which I copied from the manual.
> And I found that it's called twice.

You do realize that it's *supposed* to be called twice?  Once to
return the first row, and again to say it's done returning rows.

But the info messages you show are strange anyway.  I tried your example
here and got the results I'd expect:

regression=# select * from retcomposite(1,48);
INFO:  1
INFO:  2
INFO:  3
INFO:  4
INFO:  2
INFO:  5f1 | f2 | f3  
----+----+-----48 | 96 | 144
(1 row)

I think the code you showed must not quite match what you're actually
executing.  Maybe you recompiled the code and forgot to do a LOAD or
start a fresh session to bring in the new .so file?
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [hensa22@yahoo.es: Re: [pgsql-es-ayuda] SLL error 100% cpu]
Next
From: Josh Berkus
Date:
Subject: Re: VLDB Features