Re: Old protocol fastpath calls borked?

2019-01-24 Thread Tom Lane
Andres Freund  writes:
> Ah, brainfade.  Probably triggered by the fact that I forgot that we call
> input functions even on NULL (which never quite made sense to me).

That's so that domain_in can reject NULLs if the domain constraints
say to do so.

Mind you, the SQL committee should never have allowed NOT NULL
domain constraints in the first place, because the concept is
fundamentally incompatible with outer joins.  But it's there
and we try to honor it in this case.

regards, tom lane



Re: Old protocol fastpath calls borked?

2019-01-24 Thread Andres Freund
Hi,

On 2019-01-24 17:04:32 -0500, Tom Lane wrote:
> Andres Freund  writes:
> > In parse_fcall_arguments_20():
> > we appear to constantly setting argnull to true for all arguments?
> 
> Uh, it looks to me like it does so only if the frontend sends a -1
> length field, which is the protocol's convention for indicating a
> null.

Ah, brainfade.  Probably triggered by the fact that I forgot that we call
input functions even on NULL (which never quite made sense to me).

Greetings,

Andres Freund



Re: Old protocol fastpath calls borked?

2019-01-24 Thread Tom Lane
Andres Freund  writes:
> In parse_fcall_arguments_20():
> we appear to constantly setting argnull to true for all arguments?

Uh, it looks to me like it does so only if the frontend sends a -1
length field, which is the protocol's convention for indicating a
null.

regards, tom lane



Old protocol fastpath calls borked?

2019-01-24 Thread Andres Freund
Hi,

In parse_fcall_arguments_20():

c0a8c3ac13f8 (Tom Lane   2003-05-08 18:16:37 + 579) argsize 
= pq_getmsgint(msgBuf, 4);
0ac6298bb8ac (Tom Lane   2003-05-09 18:08:48 + 580) if 
(argsize == -1)
0ac6298bb8ac (Tom Lane   2003-05-09 18:08:48 + 581) {
0ac6298bb8ac (Tom Lane   2003-05-09 18:08:48 + 582) 
fcinfo->argnull[i] = true;
147d4bf3e5e3 (Tom Lane   2006-04-04 19:35:37 + 583) 
fcinfo->arg[i] = OidReceiveFunctionCall(typreceive, NULL,
147d4bf3e5e3 (Tom Lane   2006-04-04 19:35:37 + 584) 
typioparam, -1);
0ac6298bb8ac (Tom Lane   2003-05-09 18:08:48 + 585) 
continue;
c0a8c3ac13f8 (Tom Lane   2003-05-08 18:16:37 + 586) }

we appear to constantly setting argnull to true for all arguments?  Since,
apparently, 2003?  I don't have a test-program at hand, but that kind of seems
to suggest this never really has been used?

Greetings,

Andres Freund