On 22nd of January 2025, Tom Lane committed patch:
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
Well, commit message explains it well, but let's see it in action.
We could, for very long time (at least since year 2000!) convert a number to roman:
=$ SELECT to_char( 1976, 'RN'); to_char ───────────────── MCMLXXVI (1 ROW)
But apparently we never got function to convert back. In 2024 Hunaid Sohail noticed this, and provided necessary patch.
Now, we can simply:
=$ SELECT to_number('MCMLXXXIV', 'rn'); to_number ─────────── 1984 (1 ROW)
While I don't think roman numerals are commonly used by many, I love that someone found this omission in Pg, took time to code it, go through reviews and fixes (8 versions of the patch in total!) and got it to official PostgreSQL sources.
Great work, thanks a lot.