The following bug has been logged on the website:
Bug reference: 19652
Logged by: chunling qin
Email address: 303677365@qq.com
PostgreSQL version: 18.6
Operating system: x86_64
Description:
When the number of integer digits exceeds what the format template provides,
the excess digits are silently dropped. The very same input with a decimal
point added raises an overflow error — one "value exceeds the format"
scenario, two opposite behaviors:
SELECT to_number('1234567', '999');
-- 123 (digits beyond the 3-digit format silently discarded)
SELECT to_number('1234567.89', '999.99');
-- ERROR: numeric field overflow
-- DETAIL: A field with precision 3, scale 0 must round to an absolute
value
-- less than 10^3.
Both inputs should raise an error ("value too long" / overflow), since the
integral part exceeds the format in both cases; silently returning 123 for
'1234567' loses the high-order digits without any diagnostic.