Ran into a problem with the function manager when using a
function from a shared lib that returns a float. Sometimes
it would come back ok, other (most) times, it was trashed.
While looking thru fmgr.c, I noticed something that seems to
be the culprit, but would like a second opinion from someone else
that knows the fmgr code better.
In fmgr_c, the returnValue is a char* which is 4 bytes, but this
is very flaky when the return value is a float8 which is _8_ bytes.
My tests tell my this conversion/cast isn't right. Somethings I
lose the backend, other times I'll get gibberish back and once in a
while, it will actually work. Now, if I return a _pointer_ to a
float8, it works every time. This is a workaround, but I'd like to
find a way to have a function return a float8 without having to
palloc memory in that function.
Is this possible? Has anyone else ever successfully loaded in and
used a function that returns a float8?
Any help from a fmgr guru would be greatly appreciated...