"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