Re: [PATCH] Add roman support for to_number function

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: maciek@sakrejda.org
Cc: Hunaid Sohail <hunaidpgml@gmail.com>, pgsql-hackers@lists.postgresql.org, Tomas Vondra <tomas@vondra.me>
Date: 2025-01-21T01:41:25Z
Lists: pgsql-hackers
Maciek Sakrejda <m.sakrejda@gmail.com> writes:
> V7 passes check-world here. But, just for kicks, I generated all
> possible 7-character sequences of Roman digits [1] to confirm whether
> everything either parsed cleanly or errored cleanly. Reviewing the
> output, I noticed that to_number accepts some dubiously-formatted
> values:
> postgres=# select to_number('mmmdcm', 'RN');
>  to_number
> -----------
>       4400
> (1 row)

Ugh.  This makes more urgent my question about where roman_to_int's
algorithm came from, because there's evidently something not right
about it.

			regards, tom lane



Commits

  1. Support RN (roman-numeral format) in to_number().