diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2024-09-26 11:02:31 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2024-09-26 11:02:31 -0400 |
commit | 147bbc90f75794e5522dcbadaf2bbe1af3ce574a (patch) | |
tree | e84f92a11a5b766109dc51fe062d56e87cf41030 /doc/src | |
parent | e3a92ab0708aa8ac0c8466312cef316ea6d03c63 (diff) | |
download | postgresql-147bbc90f75794e5522dcbadaf2bbe1af3ce574a.tar.gz postgresql-147bbc90f75794e5522dcbadaf2bbe1af3ce574a.zip |
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
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/func.sgml | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index e39d524b6bd..d6acdd3059e 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -8739,6 +8739,8 @@ SELECT regexp_match('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}'); <replaceable>n</replaceable> is the number of digits following <literal>V</literal>. <literal>V</literal> with <function>to_number</function> divides in a similar manner. + The <literal>V</literal> can be thought of as marking the position + of an implicit decimal point in the input or output string. <function>to_char</function> and <function>to_number</function> do not support the use of <literal>V</literal> combined with a decimal point |