Skip to content

Commit 172e6b3

Browse files
committed
Support RN (roman-numeral format) in to_number().
We've long had roman-numeral output support in to_char(), but lacked the reverse conversion. Here it is. Author: Hunaid Sohail <hunaidpgml@gmail.com> Reviewed-by: Maciek Sakrejda <m.sakrejda@gmail.com> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Reviewed-by: Tomas Vondra <tomas@vondra.me> Discussion: https://postgr.es/m/CAMWA6ybh4M1VQqpmnu2tfSwO+3gAPeA8YKnMHVADeB=XDEvT_A@mail.gmail.com
1 parent f0ee648 commit 172e6b3

File tree

4 files changed

+350
-53
lines changed

4 files changed

+350
-53
lines changed

doc/src/sgml/func.sgml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8669,8 +8669,8 @@ SELECT regexp_match('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
86698669
<entry>plus/minus sign in specified position</entry>
86708670
</row>
86718671
<row>
8672-
<entry><literal>RN</literal></entry>
8673-
<entry>Roman numeral (input between 1 and 3999)</entry>
8672+
<entry><literal>RN</literal> or <literal>rn</literal></entry>
8673+
<entry>Roman numeral (values between 1 and 3999)</entry>
86748674
</row>
86758675
<row>
86768676
<entry><literal>TH</literal> or <literal>th</literal></entry>
@@ -8798,6 +8798,19 @@ SELECT regexp_match('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
87988798
(e.g., <literal>9.99EEEE</literal> is a valid pattern).
87998799
</para>
88008800
</listitem>
8801+
8802+
<listitem>
8803+
<para>
8804+
In <function>to_number()</function>, the <literal>RN</literal>
8805+
pattern converts Roman numerals (in standard form) to numbers.
8806+
Input is case-insensitive, so <literal>RN</literal>
8807+
and <literal>rn</literal> are equivalent. <literal>RN</literal>
8808+
cannot be used in combination with any other formatting patterns or
8809+
modifiers except <literal>FM</literal>, which is applicable only
8810+
in <function>to_char()</function> and is ignored
8811+
in <function>to_number()</function>.
8812+
</para>
8813+
</listitem>
88018814
</itemizedlist>
88028815
</para>
88038816

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy