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 1kk7WS-0000rH-FN for pgsql-bugs@arkaria.postgresql.org; Tue, 01 Dec 2020 15:24:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kk7WR-0004rY-Bk for pgsql-bugs@arkaria.postgresql.org; Tue, 01 Dec 2020 15:24:55 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kk7WR-0004rH-6A for pgsql-bugs@lists.postgresql.org; Tue, 01 Dec 2020 15:24:55 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kk7WP-0007ar-8Y for pgsql-bugs@lists.postgresql.org; Tue, 01 Dec 2020 15:24:54 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 0B1FOpqU1394963; Tue, 1 Dec 2020 10:24:52 -0500 From: Tom Lane To: hisanori.kobayashi.bp@nttdata.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16755: A specification or a bug? Digit drop on CAST from DOUBLE PRECISION to NUMERIC. In-reply-to: <16755-9889c3ce84f837e3@postgresql.org> References: <16755-9889c3ce84f837e3@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Tue, 01 Dec 2020 07:07:29 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1394961.1606836291.1@sss.pgh.pa.us> Date: Tue, 01 Dec 2020 10:24:51 -0500 Message-ID: <1394962.1606836291@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk PG Bug reporting form writes: > It would be understandable if the CAST from NUMERIC to DOUBLE PRECISION > would digit drop, but I don't know if it's a specification or a bug to digit > drop on CAST from DOUBLE PRECISION to NUMERIC. (translated by DeepL) float8_numeric() only converts DBL_DIG decimal digits. We have had discussions in the past about changing that, but so far the answer has been "no". You have to remember that digits beyond DBL_DIG are unreliable ... so sometimes this would make things better, but other times it would make things worse. If you want something that behaves like the textual display of float8, you can always do float8value::text::numeric. regards, tom lane