From: Justin Pryzby <pryzby@telsasoft.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Cc: pgsql-hackers@postgresql.org
Subject: Re: Underscores in numeric literals
Date: Tue, 27 Dec 2022 09:16:31 -0600
Message-ID: <20221227151631.GV1153@telsasoft.com> (raw)
In-Reply-To: <4015800.1672152932@sss.pgh.pa.us>
References: <84aae844-dc55-a4be-86d9-4f0fa405cc97@enterprisedb.com>
<4015800.1672152932@sss.pgh.pa.us>
On Tue, Dec 27, 2022 at 09:55:32AM -0500, Tom Lane wrote:
> Peter Eisentraut <peter.eisentraut@enterprisedb.com> 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: pryzby@telsasoft.com, tgl@sss.pgh.pa.us, peter.eisentraut@enterprisedb.com
Subject: Re: Underscores in numeric literals
In-Reply-To: <20221227151631.GV1153@telsasoft.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox