Thread: Description on bind message

Description on bind message

From
Tatsuo Ishii
Date:
In manual of "48.5. Message Formats" section, there is a description
of "Bind" message.

Int16[C]   The parameter format codes. Each must presently be zero (text) or one (binary).

This could be completely non-existent field in the current
implementation of PostgreSQL. I think the fact is not very clear from
the description. It would be nice the description is something like:

Int16[C]   The parameter format codes. Each must presently be zero (text) or one (binary).This field does not exist if
thenumber of prameter values is 0.
 

Same thing can be said to following:

Int16[R]   The result-column format codes. Each must presently be zero (text) or one (binary).
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese: http://www.sraoss.co.jp



Re: Description on bind message

From
Marko Tiikkaja
Date:
On 10/15/13 11:02 AM, Tatsuo Ishii wrote:
> In manual of "48.5. Message Formats" section, there is a description
> of "Bind" message.
>
> Int16[C]
>      The parameter format codes. Each must presently be zero (text) or one (binary).
>
> This could be completely non-existent field in the current
> implementation of PostgreSQL. I think the fact is not very clear from
> the description. It would be nice the description is something like:
>
> Int16[C]
>      The parameter format codes. Each must presently be zero (text) or one (binary).
>     This field does not exist if the number of prameter values is 0.

This is already explicitly said in the description of the previous field:

"The number of parameter format codes that follow (denoted C below). 
This can be zero to indicate that there are no parameters or that the 
parameters all use the default format (text); or one, in which case the 
specified format code is applied to all parameters; or it can equal the 
actual number of parameters."

Also the documentation for the array notation explains this: "An array 
of k n-bit integers, each in network byte order. The array length k is 
always determined by an earlier field in the message. Eg. Int16[M].".

This part seems clear enough to me, and I don't think repeating that 
*three times* is necessary.  We already say it twice.


Regards,
Marko Tiikkaja



Re: Description on bind message

From
Tatsuo Ishii
Date:
> This is already explicitly said in the description of the previous
> field:
> 
> "The number of parameter format codes that follow (denoted C
> below). This can be zero to indicate that there are no parameters or
> that the parameters all use the default format (text); or one, in
> which case the specified format code is applied to all parameters; or
> it can equal the actual number of parameters."

I know it. The confusing part is this:
 This can be zero to indicate that there are no parameters or that the parameters all use the default format (text);

Here zero has double meaning. I am not convinced until I actually
looked into the source code what this actually means.
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese: http://www.sraoss.co.jp