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 1pABh1-0000MW-B8 for pgsql-hackers@arkaria.postgresql.org; Tue, 27 Dec 2022 15:16:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pABgz-0004UN-W7 for pgsql-hackers@arkaria.postgresql.org; Tue, 27 Dec 2022 15:16: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 1pABgz-0004SH-Ja for pgsql-hackers@lists.postgresql.org; Tue, 27 Dec 2022 15:16:37 +0000 Received: from mail-io1-xd2e.google.com ([2607:f8b0:4864:20::d2e]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pABgv-0007HU-L4 for pgsql-hackers@postgresql.org; Tue, 27 Dec 2022 15:16:36 +0000 Received: by mail-io1-xd2e.google.com with SMTP id q190so7010132iod.10 for ; Tue, 27 Dec 2022 07:16:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=5LhvmIs+JzcZAygM/MWNJp2Ulrvz+J/qAndJIUHaX3M=; b=XrZPMHSZiBpTDItQrNYleJaQkmih9/s2pCBKEYWFRTMOw9X0oG7ICHjq64B6FgeZUB qUyUUO4m3ohksLDiQZN8UHGkW0/vzS4saiKTnpZUeCByWZS0msL0BKzDNJwvavzjPzvm 5YSsW0iLDZPX41WXG+37UtXA4UTVLs6ICtn1xrLX2LpyDdNm0hq4qp2MQYuYyKRNpfcp NvmWL4ZvKRpHa6lxE3zJ7bi3tf3uDhmjhKliMkJ5VtXLyauklQNuwJ6UDFxCYKzRteNm lpZ1ACL6OqDuk6J+5Sug2RcihoT6gApjOF5candj6WnMwRKzfQoZKcaFiwbjBdaRb9JN vtdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5LhvmIs+JzcZAygM/MWNJp2Ulrvz+J/qAndJIUHaX3M=; b=pbrDCSqxUUZJVZP4w8O9lkCAlZZw+1uYu5J6gdVZncNpZRqO2YHFGZAYDBBDaWxwSq yt8bpGQtvQyYsJm3OmlV6rliqEjaO21YP/lA+8mA6AobGyiULIUgMTMEMjz15KFGVPUX lFMjLt7OQWOCYhp1/WgFM7aKTZdjgnYsZRzhCyY949gkDOAX0RyxKn6d54jDGWQIzxpY JbDrG6jnkcP3qhCvu9tIXHeGeQhlMqdRiKlx481b8dLiLvPQ+ZqAuuid3lYiWmj6Sduc Akti2iCgCOLJTLfuOPFBdQcg0fONmtmQLTWxn8KU3JJHV6y10nrzah+alai0gq+VYocm DXaQ== X-Gm-Message-State: AFqh2koDzUXFB9G2P0sL0kPgwglTy/7e5yaFANX/71gM7k8mdeXNnj46 7IQsr8f/DaL3wjs99Z5+lbOYmQ== X-Google-Smtp-Source: AMrXdXufUE2ZuVkXQpzjFaK9bZ6Kq8BuqbfQU91Mi3azmPczt2p6eQ31wFPJAwr2aPWKVleLGiW/KQ== X-Received: by 2002:a6b:401a:0:b0:6e9:d035:45df with SMTP id k26-20020a6b401a000000b006e9d03545dfmr13857091ioa.6.1672154192851; Tue, 27 Dec 2022 07:16:32 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id m6-20020a6bf306000000b006c0cb1e1ea8sm4945903ioh.12.2022.12.27.07.16.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Dec 2022 07:16:32 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 81A7880074A; Tue, 27 Dec 2022 09:16:31 -0600 (CST) Date: Tue, 27 Dec 2022 09:16:31 -0600 From: Justin Pryzby To: Tom Lane Cc: Peter Eisentraut , pgsql-hackers@postgresql.org Subject: Re: Underscores in numeric literals Message-ID: <20221227151631.GV1153@telsasoft.com> References: <84aae844-dc55-a4be-86d9-4f0fa405cc97@enterprisedb.com> <4015800.1672152932@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4015800.1672152932@sss.pgh.pa.us> User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Dec 27, 2022 at 09:55:32AM -0500, Tom Lane wrote: > 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). +1 to accept underscores only in literals and leave input functions alone. (When I realized that python3.6 changed to accept things like int("3_5"), I felt compelled to write a wrapper to check for embedded underscores and raise an exception in that case. And I'm sure it affected performance.) -- Justin