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: Add non-decimal integer support to type numeric.
Date: Mon, 23 Jan 2023 19:22:53 +0000
Message-ID: <E1pK2P6-00575z-Oe@gemulon.postgresql.org> (raw)

Add non-decimal integer support to type numeric.

This enhances the numeric type input function, adding support for
hexadecimal, octal, and binary integers of any size, up to the limits
of the numeric type.

Since 6fcda9aba8, such non-decimal integers have been accepted by the
parser as integer literals and passed through to numeric_in(). This
commit gives numeric_in() the ability to handle them.

While at it, simplify the handling of NaN and infinities, reducing the
number of calls to pg_strncasecmp(), and arrange for pg_strncasecmp()
to not be called at all for regular numbers. This gives a significant
performance improvement for decimal inputs, more than offsetting the
small performance hit of checking for non-decimal input.

Discussion: https://postgr.es/m/CAEZATCV8XShnmT9HZy25C%2Bo78CVOFmUN5EM9FRAZ5xvYTggPMg%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/6dfacbf72b53b775e8442a7fd2fca7c24b139773

Modified Files
--------------
src/backend/utils/adt/numeric.c          | 360 +++++++++++++++++++++++++------
src/test/regress/expected/numeric.out    |  78 +++++--
src/test/regress/expected/numerology.out |  48 +++--
src/test/regress/sql/numeric.sql         |  14 ++
4 files changed, 405 insertions(+), 95 deletions(-)



Message-ID: <E1pK2P6-00575z-Oe@gemulon.postgresql.org>
Permalink:  ../E1pK2P6-00575z-Oe@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1pK2P6-00575z-Oe@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: Add non-decimal integer support to type numeric.
  In-Reply-To: <E1pK2P6-00575z-Oe@gemulon.postgresql.org>
  References: <E1pK2P6-00575z-Oe@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