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 1pABMi-00070k-Dm for pgsql-hackers@arkaria.postgresql.org; Tue, 27 Dec 2022 14:55:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pABMf-0005mv-90 for pgsql-hackers@arkaria.postgresql.org; Tue, 27 Dec 2022 14:55:37 +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 1pABMe-0005mm-Va for pgsql-hackers@lists.postgresql.org; Tue, 27 Dec 2022 14:55:36 +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 1pABMc-00077F-Bw for pgsql-hackers@postgresql.org; Tue, 27 Dec 2022 14:55:35 +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 2BREtWKS4015801; Tue, 27 Dec 2022 09:55:32 -0500 From: Tom Lane To: Peter Eisentraut cc: pgsql-hackers Subject: Re: Underscores in numeric literals In-reply-to: <84aae844-dc55-a4be-86d9-4f0fa405cc97@enterprisedb.com> References: <84aae844-dc55-a4be-86d9-4f0fa405cc97@enterprisedb.com> Comments: In-reply-to Peter Eisentraut message dated "Tue, 27 Dec 2022 10:15:00 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4015799.1672152932.1@sss.pgh.pa.us> Date: Tue, 27 Dec 2022 09:55:32 -0500 Message-ID: <4015800.1672152932@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Peter Eisentraut writes: > Here is a patch to add support for underscores in numeric literals, for > visual grouping, like > 1_500_000_000 > 0b10001000_00000000 > 0o_1_755 > 0xFFFF_FFFF > 1.618_034 > per SQL:202x draft. > This adds support in the lexer as well as in the integer type input > functions. > TODO: float/numeric type input support Hmm ... I'm on board with allowing this in SQL if the committee says so. I'm not especially on board with accepting it in datatype input functions. There's been zero demand for that AFAIR. Moreover, I don't think we need the inevitable I/O performance hit, nor the increased risk of accepting garbage, nor the certainty of inconsistency with other places that don't get converted (because they depend on strtoul() or whatever). We already accept that numeric input is different from numeric literals: you can't write Infinity or NaN in SQL without quotes. So I don't see an argument that we have to allow this in numeric input for consistency. regards, tom lane