From: | Maciek Sakrejda <m(dot)sakrejda(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Hunaid Sohail <hunaidpgml(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Tomas Vondra <tomas(at)vondra(dot)me> |
Subject: | Re: [PATCH] Add roman support for to_number function |
Date: | 2025-01-21 00:18:44 |
Message-ID: | CAOtHd0DvvFLnG=XufHPSZRfx+3oa3T+Z3BxxUOOrXbNjiysH5A@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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)
I'm assuming this was not intended, since the function comment notes
the result will be in the 1-3999 range. (And to_char fails to parse
this, failing the round-trip test.)
Thanks,
Maciek
[1]: with rd(d) as (VALUES('i'),('v'),('x'),('l'),('c'),('d'),('m')),
rn as (select d1.d || d2.d || d3.d || d4.d || d5.d || d6.d || d7.d as
n from rd d1, rd d2, rd d3, rd d4, rd d5, rd d6, rd d7) select 'select
to_number(' || rn.n || ', ''RN'');' from rn;
From | Date | Subject | |
---|---|---|---|
Next Message | Jacob Champion | 2025-01-21 00:40:36 | Re: [PoC] Federated Authn/z with OAUTHBEARER |
Previous Message | Jeff Davis | 2025-01-20 23:31:27 | Re: Statistics Import and Export |