Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jjRBR-0002Le-GQ for pgsql-docs@arkaria.postgresql.org; Thu, 11 Jun 2020 17:40:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jjRBO-0007RX-1c for pgsql-docs@arkaria.postgresql.org; Thu, 11 Jun 2020 17:40:06 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jjRBN-0007RQ-Rl for pgsql-docs@lists.postgresql.org; Thu, 11 Jun 2020 17:40:05 +0000 Received: from forward2-smtp.messagingengine.com ([66.111.4.226]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jjRBJ-0005rk-Je for pgsql-docs@lists.postgresql.org; Thu, 11 Jun 2020 17:40:05 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailforward.nyi.internal (Postfix) with ESMTP id D9F7C1940C49; Thu, 11 Jun 2020 13:39:58 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Thu, 11 Jun 2020 13:39:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=FeRqkBEanHLgBL0dRVa31InXNFGxtZv+DwePZVV6W 0Y=; b=hVcbL/nJSzGDRv/n9op6HLzLySNk/Ypm9MPVIQ0Iwq7sSQERCCIeOQz2Q rwR5TRbnjAb2/hLktbTaDmKtPnX8KItG3sFbC9QubU9guh3xW8vKDyEdI+mSkTZ3 lEPrYKQyGWCHB0h65/JS4Ah3sEOiifmOpP/z8B0PxIqdxgiRcoNf3R6TnpBHJlK1 vEtbAsKKmy5OjjWEvxmnS9F3AFO7kSgFQ1wYAHOccU4gwiH40sFRdcBsT+Hk0PfI CwXUrrTQCQTSM4qKAtoveI8C9m7gfPubFPws1nhpIGLe1IKXFoA0OYE8qUjoOYa2 hM2+HxQ1flOuW/DNFB/DsId52XdIw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudehledgleduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvfhfhfhokffffgggjggtgfesth ejredttdefjeenucfhrhhomheprfgvthgvrhcugfhishgvnhhtrhgruhhtuceophgvthgv rhdrvghishgvnhhtrhgruhhtsedvnhguqhhurggurhgrnhhtrdgtohhmqeenucggtffrrg htthgvrhhnpeehgefgvdevkeffheetgfetheetudfgleeggfdtffduhfelheefgfduhfff jeetheenucffohhmrghinhepphhoshhtghhrvghsqhhlrdhorhhgpddvnhguqhhurggurh grnhhtrdgtohhmnecukfhppeelfedrvdegfedrkedvrddvgeeinecuvehluhhsthgvrhfu ihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepphgvthgvrhdrvghishgvnhhtrh gruhhtsedvnhguqhhurggurhgrnhhtrdgtohhm X-ME-Proxy: Received: from april.pezone.net (p5df352f6.dip0.t-ipconnect.de [93.243.82.246]) by mail.messagingengine.com (Postfix) with ESMTPA id DF7103060FE7; Thu, 11 Jun 2020 13:39:57 -0400 (EDT) Subject: Re: Signed-ness of ints is unclear in FE-BE protocol docs To: roji@roji.org, pgsql-docs@lists.postgresql.org References: <159173854100.661.1819403154632752741@wrigleys.postgresql.org> From: Peter Eisentraut Organization: 2ndQuadrant Message-ID: Date: Thu, 11 Jun 2020 19:39:55 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <159173854100.661.1819403154632752741@wrigleys.postgresql.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-06-09 23:35, PG Doc comments form wrote: > The protocol docs generally do not mention whether ints are signed or > unsigned - this has actually bitten me once in the past, where a signed int > was accidentally used to interpret an unsigned int coming from PostgreSQL, > leading to issues. The ambiguity has made me resort to inspecting the > PostgreSQL sources in order to be sure. > > First, I'd consider clarifying this on the "Message Data Types" page > (https://www.postgresql.org/docs/current/protocol-message-types.html). sure > Second, across the protocol docs, rather than using Int32 and Int64, which > generally look like they're signed (depending on which language you're > coming from), I'd consider using UInt32/UInt64, which are unambiguous with > regards to signed-ness. Well, they are actually signed, so I'm confused why you think we should change the documentation to unsigned. -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services