Underscores in numeric literals

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Underscores in numeric literals
Date: 2022-12-27 09:15:00
Message-ID: 84aae844-dc55-a4be-86d9-4f0fa405cc97@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

I did some performance tests similar to what was done in [0] and didn't
find any problematic deviations. Other tests would be welcome.

[0]:
https://www.postgresql.org/message-id/flat/b239564c-cad0-b23e-c57e-166d883cb97d(at)enterprisedb(dot)com

Attachment Content-Type Size
v1-0001-Underscores-in-numeric-literals.patch text/plain 26.7 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2022-12-27 09:20:48 Re: Exit walsender before confirming remote flush in logical replication
Previous Message Peter Eisentraut 2022-12-27 08:56:10 Refactor recordExtObjInitPriv()