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.98.2) (envelope-from ) id 1xDqcA-00000000lOU-0ksD for pgsql-bugs@arkaria.postgresql.org; Mon, 05 Oct 2026 21:52:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xDqc8-0000000DHaN-2iTr for pgsql-bugs@arkaria.postgresql.org; Mon, 05 Oct 2026 21:52:52 +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.98.2) (envelope-from ) id 1xDqc8-0000000DHaE-1foL for pgsql-bugs@lists.postgresql.org; Mon, 05 Oct 2026 21:52:52 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xDqc6-00000000XmU-2ygH for pgsql-bugs@lists.postgresql.org; Mon, 05 Oct 2026 21:52:51 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.18.1/8.18.1) with ESMTP id 695LqnMV1203132; Mon, 5 Oct 2026 17:52:49 -0400 From: Tom Lane To: kehan5800@gmail.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #19744: contrib/seg output truncates to 6 significant digits, breaking dump/restore In-reply-to: <19744-8c700582bbb1d075@postgresql.org> References: <19744-8c700582bbb1d075@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Sun, 04 Oct 2026 05:16:30 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1203130.1791237169.1@sss.pgh.pa.us> Date: Mon, 05 Oct 2026 17:52:49 -0400 Message-ID: <1203131.1791237169@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Bug reporting form writes: > In practice a 7-significant-digit value is stored exactly Some of them are, but please don't claim that on the strength of one test case. > but printed with 6 digits: > CREATE EXTENSION seg; > SELECT '1234567'::seg AS printed, > seg_lower('1234567'::seg)::float8 AS stored, > '1234567'::seg::text::seg = '1234567'::seg AS round_trips; I do not think this is a code bug. The code clearly intends to render values exactly as long as they're no more than FLT_DIG digits wide, and it accomplishes that, and it cannot expect to do more because the underlying storage can't promise more. It does seem like a documentation bug that the docs are written as if FLT_DIG were 7. That's not so on any modern platform, and even when these docs were written I doubt that anything had that. regards, tom lane