FF3 vs MS Date/Time Template - ERROR: date/time field value out of range
От | Nick Davies |
---|---|
Тема | FF3 vs MS Date/Time Template - ERROR: date/time field value out of range |
Дата | |
Msg-id | AM8PR08MB6356AC979252CFEA78B56678B6312@AM8PR08MB6356.eurprd08.prod.outlook.com обсуждение исходный текст |
Ответы |
Re: FF3 vs MS Date/Time Template - ERROR: date/time field value out of range
|
Список | pgsql-bugs |
Hi,
We have some legacy tables with timestamps in an unusual String format - year, month, day, hour, minute, second, millisecond with no separators.
In the docs it appears the 'MS' and 'FF3' date time template patterns are identical but the behaviour is different. We also support Oracle which doesn't have 'MS', so we tried to use the pattern 'YYYYMMDDHH24MISSFF3'. This doesn't work, but switching to 'MS' does.
-------------------------------------------------------------------------------------
psql (17.2 (Debian 17.2-1.pgdg120+1))
Type "help" for help.
postgres=# select to_timestamp('20241206111433123', 'YYYYMMDDHH24MISSFF3');
ERROR: date/time field value out of range: "20241206111433123"
postgres=# select to_timestamp('20241206111433123', 'YYYYMMDDHH24MISSMS');
to_timestamp
----------------------------
2024-12-06 11:14:33.123+00
(1 row)
-------------------------------------------------------------------------------------
Other observations:
- I'd expect these patterns to work the same way - or at least to be documented differently.
- FF3 works fine if there's a separator in the string, i.e. select to_timestamp('20241206111433.123', 'YYYYMMDDHH24MISS.FF3');
- The other FF<n> patterns behave the same way.
- I've reproduced this on Postgres 17.2 on Linux/x86_64 and Linux/ARM64, and also Postgres 13.18 on Linux/ARM64
Thanks very much,
Nick Davies
В списке pgsql-bugs по дате отправления: