Re: Clarification suggestion for 46.4 chapter.

Started by Bruce Momjianover 13 years ago3 messagesdocs
Jump to latest
#1Bruce Momjian
bruce@momjian.us

On Mon, Dec 5, 2011 at 02:53:22PM +0300, Dmitriy Igrishin wrote:

Hey,

The section 46.4 describes the base data types used in messages.
http://www.postgresql.org/docs/9.1/static/protocol-message-types.html

According to section 46.5
http://www.postgresql.org/docs/9.1/static/protocol-message-formats.html
there are cases when Int32 can be negative (e.g. see DataRow(B) message
description.)

Thus, I would like to suggest to change the description of Int(i)
from
"An n-bit integer in network byte order ..."
to
"An n-bit signed integer in network byte order ..."

OK, documentation updated.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +

Attachments:

int.difftext/x-diff; charset=us-asciiDownload+2-2
#2Heikki Linnakangas
heikki.linnakangas@enterprisedb.com
In reply to: Bruce Momjian (#1)

On 17.08.2012 05:07, Bruce Momjian wrote:

On Mon, Dec 5, 2011 at 02:53:22PM +0300, Dmitriy Igrishin wrote:

Hey,

The section 46.4 describes the base data types used in messages.
http://www.postgresql.org/docs/9.1/static/protocol-message-types.html

According to section 46.5
http://www.postgresql.org/docs/9.1/static/protocol-message-formats.html
there are cases when Int32 can be negative (e.g. see DataRow(B) message
description.)

Thus, I would like to suggest to change the description of Int(i)
from
"An n-bit integer in network byte order ..."
to
"An n-bit signed integer in network byte order ..."

OK, documentation updated.

Actually, in some cases the integers are signed, and in others unsigned.
For example, in a Bind('F') message, the number of parameters is an
Int16 according to the docs, but it is treated as unsigned. The maximum
number of parameters is 65535.

The sentence used to be factually correct, when it didn't mention
whether they're signed or unsigned. If we want to do better than that,
we'd need to go through all the mentions of IntN in the docs and
explicitly say which ones are signed and which ones unsigned. Perhaps
use Uint16 or Uint32 for the unsigned ones.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

#3Bruce Momjian
bruce@momjian.us
In reply to: Heikki Linnakangas (#2)

On Fri, Aug 17, 2012 at 11:54:54AM +0300, Heikki Linnakangas wrote:

On 17.08.2012 05:07, Bruce Momjian wrote:

On Mon, Dec 5, 2011 at 02:53:22PM +0300, Dmitriy Igrishin wrote:

Hey,

The section 46.4 describes the base data types used in messages.
http://www.postgresql.org/docs/9.1/static/protocol-message-types.html

According to section 46.5
http://www.postgresql.org/docs/9.1/static/protocol-message-formats.html
there are cases when Int32 can be negative (e.g. see DataRow(B) message
description.)

Thus, I would like to suggest to change the description of Int(i)
from
"An n-bit integer in network byte order ..."
to
"An n-bit signed integer in network byte order ..."

OK, documentation updated.

Actually, in some cases the integers are signed, and in others
unsigned. For example, in a Bind('F') message, the number of
parameters is an Int16 according to the docs, but it is treated as
unsigned. The maximum number of parameters is 65535.

The sentence used to be factually correct, when it didn't mention
whether they're signed or unsigned. If we want to do better than
that, we'd need to go through all the mentions of IntN in the docs
and explicitly say which ones are signed and which ones unsigned.
Perhaps use Uint16 or Uint32 for the unsigned ones.

I have reverted the patch until someone is able to correctly designate
the values. Thanks.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +