Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1usH5Y-002a1N-Ew for pgsql-bugs@arkaria.postgresql.org; Sat, 30 Aug 2025 08:37:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1usH5W-00EjF8-HN for pgsql-bugs@arkaria.postgresql.org; Sat, 30 Aug 2025 08:37:31 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1us52m-00CVdo-9M for pgsql-bugs@lists.postgresql.org; Fri, 29 Aug 2025 19:45:53 +0000 Received: from fout-b1-smtp.messagingengine.com ([202.12.124.144]) by makus.postgresql.org with smtp (Exim 4.96) (envelope-from ) id 1us52j-002Q7m-2p for pgsql-bugs@lists.postgresql.org; Fri, 29 Aug 2025 19:45:51 +0000 Received: from phl-compute-10.internal (phl-compute-10.internal [10.202.2.50]) by mailfout.stl.internal (Postfix) with ESMTP id 93F5E1D000ED for ; Fri, 29 Aug 2025 15:45:49 -0400 (EDT) Received: from phl-imap-15 ([10.202.2.104]) by phl-compute-10.internal (MEProxy); Fri, 29 Aug 2025 15:45:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unusedvar.com; h=cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:message-id:mime-version:reply-to :subject:subject:to:to; s=fm2; t=1756496749; x=1756583149; bh=tU HJvZAI+2IdLSG8Z4MQ2MkO9JLYV2QZQUQJvUM1Xl4=; b=m4G/KG/+pfbNJEMj8d oPjEllo7uFnVhAjHfj7ICk/q1/dHXduCIAxPTa+0qMFbJrchIWq1PDE3dh+WXPLT zPxLaLMKBXpbQAMSEuTAbRcv0QpjaapnuWTjHnvnK8k0cFVyqXVGDsGsyDWoFfkB p40BSuLBOhdwpTlcc5wKY9AUvw1CUTRXRX9HgqX+mZMERhp/22fnPDQ+OqHtjYCR 13r169Pm1tpzsxF7cYPQIjHK0+JQJp2/Jyqei1EoXGm0j0hmY4i9N3Sf0OVX54Qq MUU2Z9j/ufW1YP5/jWoisWvqUvsYbNeALGNxQx48sp3X62ndzOSwhAx512Aj0FiY pWaA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:message-id:mime-version:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1756496749; x=1756583149; bh=tUHJvZAI+2IdLSG8Z4MQ2MkO9JLYV2QZQUQ JvUM1Xl4=; b=cQnr1+pFQkdqkG9G/Be8TG0APx0fBQRo1SXGPF/sfZ0F920UU8D V9wZ6I9vy3MyuK0K8e5ujl9RMqjzmqh/MwArdcYLptTZBFVAcgK3uiv4WXj+mZNW 2yRCE4eWszz+JfC9bweGTj0BqCgw1OYdCnPLXkA0MaWKYmVe0PCDzsJGpb7EVZGI SmLTiSwvHqKu8FXyH+m0w004kUeH06RWkDDn4evZUsyedGmtWSEJcEvyvfpJnBA1 +nwFv+rsmqPTcdGuUbTAdsL5ZEzBi6X9tbj4g04PCq/KTi/yK07yA/jbnFRRKvy/ T6+1YOupdUFYJIo2H2OHrYBQJasw99ZTmmg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgddukeegfeekucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpefoggffhffvkffutgfgsehtjeertdertd dtnecuhfhrohhmpedftfgrnhcuuegvnhhithgrfdcuoehrrghnsehunhhushgvughvrghr rdgtohhmqeenucggtffrrghtthgvrhhnpeeghfeiiefgteejkeejgeffleevtdegtedtge eileehledtheetleevteegfefgveenucffohhmrghinhepfhgvqdhtrhgrtggvrdgtfien ucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehrrghnse hunhhushgvughvrghrrdgtohhmpdhnsggprhgtphhtthhopedupdhmohguvgepshhmthhp ohhuthdprhgtphhtthhopehpghhsqhhlqdgsuhhgsheslhhishhtshdrphhoshhtghhrvg hsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i5ea94479:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 2F67D7840CE; Fri, 29 Aug 2025 15:45:49 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface MIME-Version: 1.0 Date: Fri, 29 Aug 2025 22:45:18 +0300 From: "Ran Benita" To: pgsql-bugs@lists.postgresql.org Message-Id: Subject: Broken PQtrace CopyData display Content-Type: text/plain Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I used PQtrace to trace a logical decoding session, and was confused to see lines like this: 2025-08-29 22:09:57.633980 F 38 CopyData 'r\x00\x00\x00\x00\xffffff8e\x07\xffffff85x\x00\x00\x00\x00\xffffff8e\x07\xffffff85x\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\xffffffe0\xffffff84\xffffff89R\xffffffd7\xffffffb8\x00' The data doesn't make sense and has the wrong length. A quick look shows that the \xffffff85 parts are a signedness issue (on my compiler char is signed). I instead expect to see output like this: 2025-08-29 22:39:17.041261 F 38 CopyData 'r\x00\x00\x00\x00\x8e\x07\x89\xf8\x00\x00\x00\x00\x8e\x07\x89\xf8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\xe0\x84\xf21Dh\x00' The diff below fixes this particular problem, though they say bugs are like mushrooms, if you find one then there are probably others nearby, so a more comprehensive fix may be warranted. diff --git i/src/interfaces/libpq/fe-trace.c w/src/interfaces/libpq/fe-trace.c index a45f0d85587..f487c111fc7 100644 --- i/src/interfaces/libpq/fe-trace.c +++ w/src/interfaces/libpq/fe-trace.c @@ -212,7 +212,7 @@ pqTraceOutputNchar(FILE *pfdebug, int len, const char *data, int *cursor, bool s else { fwrite(v + next, 1, i - next, pfdebug); - fprintf(pfdebug, "\\x%02x", v[i]); + fprintf(pfdebug, "\\x%02x", (unsigned char) v[i]); next = i + 1; } }