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 1jjoCX-00015c-MH for pgsql-hackers@arkaria.postgresql.org; Fri, 12 Jun 2020 18:14:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jjoCW-0003J7-KU for pgsql-hackers@arkaria.postgresql.org; Fri, 12 Jun 2020 18:14:48 +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 1jjoCW-0003Iz-Dr for pgsql-hackers@lists.postgresql.org; Fri, 12 Jun 2020 18:14:48 +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 1jjoCT-0000er-7C for pgsql-hackers@lists.postgresql.org; Fri, 12 Jun 2020 18:14:47 +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 05CIEhAe774768; Fri, 12 Jun 2020 14:14:43 -0400 From: Tom Lane To: Robert Haas cc: PostgreSQL Hackers Subject: Re: Infinities in type numeric In-reply-to: References: <606717.1591924582@sss.pgh.pa.us> <702941.1591981259@sss.pgh.pa.us> Comments: In-reply-to Robert Haas message dated "Fri, 12 Jun 2020 13:44:05 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <774766.1591985683.1@sss.pgh.pa.us> Date: Fri, 12 Jun 2020 14:14:43 -0400 Message-ID: <774767.1591985683@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Robert Haas writes: > BTW, has there been any thought to supporting a negative scale for the > numeric data type? If you can cut off digits after the decimal, why > not before? Hm, would there be any real use-case? An implementation issue is that even in the "long" numeric format, we cram dscale into a 14-bit unsigned field. You could redefine the field as signed and pray that nobody has dscales above 8K stored on disk, but I'm dubious that there's a good argument for taking that risk. There might be algorithmic issues as well, haven't really looked. Any such problems would probably be soluble, if need be by forcing the scale to be at least 0 for calculation and then rounding afterwards. regards, tom lane