From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Modernize to_char's Roman-numeral code, fixing overflow problems
Date: Thu, 26 Sep 2024 15:02:34 +0000
Message-ID: <E1stq0o-00122e-7r@gemulon.postgresql.org> (raw)
Modernize to_char's Roman-numeral code, fixing overflow problems.
int_to_roman() only accepts plain "int" input, which is fine since
we're going to produce '###############' for any value above 3999
anyway. However, the numeric and int8 variants of to_char() would
throw an error if the given input exceeded the integer range, while
the float-input variants invoked undefined-per-C-standard behavior.
Fix things so that you uniformly get '###############' for out of
range input.
Also add test cases covering this code, plus the equally-untested
EEEE, V, and PL format codes.
Discussion: https://postgr.es/m/2956175.1725831136@sss.pgh.pa.us
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/147bbc90f75794e5522dcbadaf2bbe1af3ce574a
Modified Files
--------------
doc/src/sgml/func.sgml | 2 +
src/backend/utils/adt/formatting.c | 92 ++++++++++++++++++++++++++---------
src/test/regress/expected/int8.out | 50 +++++++++++++++++++
src/test/regress/expected/numeric.out | 87 +++++++++++++++++++++++++++++++++
src/test/regress/sql/int8.sql | 8 +++
src/test/regress/sql/numeric.sql | 15 ++++++
6 files changed, 231 insertions(+), 23 deletions(-)
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-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Modernize to_char's Roman-numeral code, fixing overflow problems
In-Reply-To: <E1stq0o-00122e-7r@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