Re: Questions about the internal of fastpath function call - Mailing list pgsql-hackers

From lee Richard
Subject Re: Questions about the internal of fastpath function call
Date
Msg-id BANLkTik61xQBrT0_d_DVevcSug6C5K=FyQ@mail.gmail.com
Whole thread Raw
In response to Re: Questions about the internal of fastpath function call  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom,

Thanks a lot.

The part I cant understand is I cant see where SendFunctionResult construct the return value into the buf. I expect it should copy something in retval to buf, but I cant find any of this in the code, the main logic of SendFunctionResult is:

00159             getTypeOutputInfo(rettype, &typoutput, &typisvarlena);
00160             outputstr = OidOutputFunctionCall(typoutput, retval);
00161             pq_sendcountedtext(&buf, outputstr, strlen(outputstr), false);
00162             pfree(outputstr);
I think it should copy the real result in OidOutputFunctionCall, but unfortunately I can only find it call FunctionCall1() again. Do I miss something?

If I copy the tuples returnned from pl module here, is it possible to send a vector result from fastpath function call?

2011/5/9 Tom Lane <tgl@sss.pgh.pa.us>
lee Richard <clipper.kenyon@gmail.com> writes:
> I still can not see how it return a single return value to the client, and
> why it call FunctionCall1() again when it want to send the result.

pq_endmessage is where the bytes actually get pushed out to the client,
if that's what you're looking for.  The rest of the activity in
SendFunctionResult is just concerned with constructing the message to be
sent within "buf".

                       regards, tom lane

pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: XML with invalid chars
Next
From: Tom Lane
Date:
Subject: "make check" in src/test/isolation is unworkable