pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dean Rasheed <dean.a.rasheed@gmail.com>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Allow underscores in integer and numeric constants.
Date: Sat, 04 Feb 2023 09:51:09 +0000
Message-ID: <E1pOFCO-001X6k-1M@gemulon.postgresql.org> (raw)

Allow underscores in integer and numeric constants.

This allows underscores to be used in integer and numeric literals,
and their corresponding type input functions, for visual grouping.
For example:

    1_500_000_000
    3.14159_26535_89793
    0xffff_ffff
    0b_1001_0001

A single underscore is allowed between any 2 digits, or immediately
after the base prefix indicator of non-decimal integers, per SQL:202x
draft.

Peter Eisentraut and Dean Rasheed

Discussion: https://postgr.es/m/84aae844-dc55-a4be-86d9-4f0fa405cc97%40enterprisedb.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/faff8f8e47f18c7d589453e2e0d841d2bd96c1ac

Modified Files
--------------
doc/src/sgml/syntax.sgml                      |  36 ++--
src/backend/catalog/sql_features.txt          |   1 +
src/backend/parser/parse_node.c               |  43 +---
src/backend/parser/scan.l                     |  27 +--
src/backend/utils/adt/numeric.c               | 106 +++++++---
src/backend/utils/adt/numutils.c              | 273 ++++++++++++++++++++------
src/fe_utils/psqlscan.l                       |  16 +-
src/interfaces/ecpg/preproc/pgc.l             |  16 +-
src/pl/plpgsql/src/expected/plpgsql_trap.out  |   2 +-
src/pl/plpgsql/src/sql/plpgsql_trap.sql       |   2 +-
src/test/regress/expected/int2.out            |  44 +++++
src/test/regress/expected/int4.out            |  44 +++++
src/test/regress/expected/int8.out            |  44 +++++
src/test/regress/expected/numeric.out         |  62 +++++-
src/test/regress/expected/numerology.out      |  92 ++++++++-
src/test/regress/expected/partition_prune.out |   6 +-
src/test/regress/sql/int2.sql                 |  14 ++
src/test/regress/sql/int4.sql                 |  14 ++
src/test/regress/sql/int8.sql                 |  14 ++
src/test/regress/sql/numeric.sql              |  22 ++-
src/test/regress/sql/numerology.sql           |  24 ++-
src/test/regress/sql/partition_prune.sql      |   6 +-
22 files changed, 724 insertions(+), 184 deletions(-)



Message-ID: <E1pOFCO-001X6k-1M@gemulon.postgresql.org>
Permalink:  ../E1pOFCO-001X6k-1M@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1pOFCO-001X6k-1M@gemulon.postgresql.org

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: dean.a.rasheed@gmail.com
  Subject: Re: pgsql: Allow underscores in integer and numeric constants.
  In-Reply-To: <E1pOFCO-001X6k-1M@gemulon.postgresql.org>
  References: <E1pOFCO-001X6k-1M@gemulon.postgresql.org>

* 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