Re: Questions about the internal of fastpath function call

From: lee Richard <clipper(dot)kenyon(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Merlin Moncure <mmoncure(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Questions about the internal of fastpath function call
Date: 2011-05-08 23:30:26
Message-ID: BANLkTik61xQBrT0_d_DVevcSug6C5K=FyQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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
<http://doxygen.postgresql.org/lsyscache_8c.html#48d637426d06bfdf607eb29da3be558a>(rettype
<http://doxygen.postgresql.org/structfp__info.html#2b1f02caad79fae010cdc5836a2fcb83>,
&typoutput, &typisvarlena);00160 outputstr =
OidOutputFunctionCall
<http://doxygen.postgresql.org/fmgr_8c.html#9b747dd35f098ab369b44e94f4708210>(typoutput,
retval);00161 pq_sendcountedtext
<http://doxygen.postgresql.org/pqformat_8c.html#e6acc43bbc9bee686de201de82a26db5>(&buf,
outputstr, strlen(outputstr), false);00162 pfree
<http://doxygen.postgresql.org/mcxt_8c.html#4de9741ca04b2f01a82d3de16a1d6bf2>(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(at)sss(dot)pgh(dot)pa(dot)us>

> lee Richard <clipper(dot)kenyon(at)gmail(dot)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
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2011-05-08 23:35:31 "make check" in src/test/isolation is unworkable
Previous Message Andrew Dunstan 2011-05-08 22:25:27 Re: XML with invalid chars