pgsql: Fix numeric_mul() overflow due to too many digits after decimal

From: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix numeric_mul() overflow due to too many digits after decimal
Date: 2021-07-10 11:54:15
Message-ID: E1m2BYl-0007cF-AL@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Fix numeric_mul() overflow due to too many digits after decimal point.

This fixes an overflow error when using the numeric * operator if the
result has more than 16383 digits after the decimal point by rounding
the result. Overflow errors should only occur if the result has too
many digits *before* the decimal point.

Discussion: https://postgr.es/m/CAEZATCUmeFWCrq2dNzZpRj5+6LfN85jYiDoqm+ucSXhb9U2TbA@mail.gmail.com

Branch
------
master

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

Modified Files
--------------
src/backend/utils/adt/numeric.c | 10 +++++++++-
src/test/regress/expected/numeric.out | 6 ++++++
src/test/regress/sql/numeric.sql | 2 ++
3 files changed, 17 insertions(+), 1 deletion(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2021-07-10 12:49:14 pgsql: Add more sanity checks in SASL exchanges
Previous Message Tom Lane 2021-07-09 20:59:27 pgsql: Un-break AIX build, take 2.

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2021-07-10 12:11:20 Re: [PoC] Improve dead tuple storage for lazy vacuum
Previous Message John Naylor 2021-07-10 11:49:08 Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW