From c4bf7e27a96602409b08eef9bbd9e4ce75aec000 Mon Sep 17 00:00:00 2001 From: Dave Cramer Date: Thu, 21 May 2026 08:31:48 -0700 Subject: [PATCH] doc: clarify signedness of integer fields in protocol messages Add (unsigned) or (signed) annotations to protocol message fields to help client implementors correctly size their integer types when parsing or constructing protocol messages. --- doc/src/sgml/protocol.sgml | 52 +++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/doc/src/sgml/protocol.sgml b/doc/src/sgml/protocol.sgml index 49f81676712..c6cefb48434 100644 --- a/doc/src/sgml/protocol.sgml +++ b/doc/src/sgml/protocol.sgml @@ -4242,7 +4242,7 @@ psql "dbname=postgres replication=database" -c "IDENTIFY_SYSTEM;" Int32 - The process ID of this backend. + The process ID of this backend (signed). @@ -4326,7 +4326,7 @@ psql "dbname=postgres replication=database" -c "IDENTIFY_SYSTEM;" 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. + parameters (unsigned). @@ -4346,7 +4346,8 @@ psql "dbname=postgres replication=database" -c "IDENTIFY_SYSTEM;" The number of parameter values that follow (possibly zero). - This must match the number of parameters needed by the query. + This must match the number of parameters needed by the query + (unsigned). @@ -4362,7 +4363,7 @@ psql "dbname=postgres replication=database" -c "IDENTIFY_SYSTEM;" The length of the parameter value, in bytes (this count - does not include itself). Can be zero. + does not include itself, signed). Can be zero. As a special case, -1 indicates a NULL parameter value. No value bytes follow in the NULL case. @@ -4397,7 +4398,7 @@ psql "dbname=postgres replication=database" -c "IDENTIFY_SYSTEM;" (text); or one, in which case the specified format code is applied to all result columns (if any); or it can equal the actual - number of result columns of the query. + number of result columns of the query (unsigned). @@ -4795,7 +4796,7 @@ psql "dbname=postgres replication=database" -c "IDENTIFY_SYSTEM;" The number of columns in the data to be copied - (denoted N below). + (denoted N below, unsigned). @@ -4855,7 +4856,7 @@ psql "dbname=postgres replication=database" -c "IDENTIFY_SYSTEM;" The number of columns in the data to be copied - (denoted N below). + (denoted N below, unsigned). @@ -4915,7 +4916,7 @@ psql "dbname=postgres replication=database" -c "IDENTIFY_SYSTEM;" The number of columns in the data to be copied - (denoted N below). + (denoted N below, unsigned). @@ -4960,7 +4961,8 @@ psql "dbname=postgres replication=database" -c "IDENTIFY_SYSTEM;" Int16 - The number of column values that follow (possibly zero). + The number of column values that follow (possibly zero, + unsigned). @@ -4976,7 +4978,7 @@ psql "dbname=postgres replication=database" -c "IDENTIFY_SYSTEM;" The length of the column value, in bytes (this count - does not include itself). Can be zero. + does not include itself, signed). Can be zero. As a special case, -1 indicates a NULL column value. No value bytes follow in the NULL case. @@ -5164,7 +5166,7 @@ psql "dbname=postgres replication=database" -c "IDENTIFY_SYSTEM;" Maximum number of rows to return, if portal contains a query that returns rows (ignored otherwise). Zero - denotes no limit. + denotes no limit (unsigned). @@ -5238,7 +5240,7 @@ psql "dbname=postgres replication=database" -c "IDENTIFY_SYSTEM;" or that the arguments all use the default format (text); or one, in which case the specified format code is applied to all arguments; or it can equal the actual number of - arguments. + arguments (unsigned). @@ -5258,7 +5260,7 @@ psql "dbname=postgres replication=database" -c "IDENTIFY_SYSTEM;" Specifies the number of arguments being supplied to the - function. + function (unsigned). @@ -5274,7 +5276,7 @@ psql "dbname=postgres replication=database" -c "IDENTIFY_SYSTEM;" The length of the argument value, in bytes (this count - does not include itself). Can be zero. + does not include itself, signed). Can be zero. As a special case, -1 indicates a NULL argument value. No value bytes follow in the NULL case. @@ -5338,7 +5340,7 @@ psql "dbname=postgres replication=database" -c "IDENTIFY_SYSTEM;" The length of the function result value, in bytes (this count - does not include itself). Can be zero. + does not include itself, signed). Can be zero. As a special case, -1 indicates a NULL function result. No value bytes follow in the NULL case. @@ -5460,7 +5462,8 @@ psql "dbname=postgres replication=database" -c "IDENTIFY_SYSTEM;" Int32 - Number of protocol options not recognized by the server. + Number of protocol options not recognized by the server + (unsigned). @@ -5592,7 +5595,7 @@ psql "dbname=postgres replication=database" -c "IDENTIFY_SYSTEM;" Int32 - The process ID of the notifying backend process. + The process ID of the notifying backend process (signed). @@ -5645,7 +5648,7 @@ psql "dbname=postgres replication=database" -c "IDENTIFY_SYSTEM;" The number of parameters used by the statement - (can be zero). + (can be zero, unsigned). @@ -5760,7 +5763,7 @@ psql "dbname=postgres replication=database" -c "IDENTIFY_SYSTEM;" (can be zero). Note that this is not an indication of the number of parameters that might appear in the query string, only the number that the frontend wants to - prespecify types for. + prespecify types for (unsigned). @@ -5972,7 +5975,8 @@ psql "dbname=postgres replication=database" -c "IDENTIFY_SYSTEM;" Int16 - Specifies the number of fields in a row (can be zero). + Specifies the number of fields in a row (can be zero, + unsigned). @@ -6025,7 +6029,8 @@ psql "dbname=postgres replication=database" -c "IDENTIFY_SYSTEM;" Int16 - The data type size (see pg_type.typlen). + The data type size (see pg_type.typlen, + signed). Note that negative values denote variable-width types. @@ -6035,7 +6040,8 @@ psql "dbname=postgres replication=database" -c "IDENTIFY_SYSTEM;" Int32 - The type modifier (see pg_attribute.atttypmod). + The type modifier (see pg_attribute.atttypmod, + signed). The meaning of the modifier is type-specific. @@ -6095,7 +6101,7 @@ psql "dbname=postgres replication=database" -c "IDENTIFY_SYSTEM;" Length of SASL mechanism specific "Initial Client Response" that - follows, or -1 if there is no Initial Response. + follows (signed), or -1 if there is no Initial Response. -- 2.50.1 (Apple Git-155)