Re: Bug in to_timestamp().
От | Alex Ignatov |
---|---|
Тема | Re: Bug in to_timestamp(). |
Дата | |
Msg-id | 0f8caaa5-9d9d-ff3f-a7a3-223aefc96da4@postgrespro.ru обсуждение исходный текст |
Ответ на | Re: Bug in to_timestamp(). (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-hackers |
On 20.06.2016 16:36, Tom Lane wrote: > Robert Haas <robertmhaas@gmail.com> writes: >> On Mon, Jun 13, 2016 at 12:25 PM, Robert Haas <robertmhaas@gmail.com> wrote: >>> I think a space in the format string should skip a whitespace >>> character in the input string, but not a non-whitespace character. >>> It's my understanding that these functions exist in no small part for >>> compatibility with Oracle, and Oracle declines to skip the digit '1' >>> on the basis of an extra space in the format string, which IMHO is the >>> behavior any reasonable user would expect. >> So Amul and I are of one opinion and Tom is of another. Anyone else >> have an opinion? > I don't necessarily have an opinion yet. I would like to see more than > just an unsupported assertion about what Oracle's behavior is. Also, > how should FM mode affect this? > > regards, tom lane > > Oracle: SQL> SELECT TO_TIMESTAMP('2016-06-13 99:99:99', 'YYYYMMDD HH24:MI:SS') from dual; SELECT TO_TIMESTAMP('2016-06-13 99:99:99', 'YYYYMMDD HH24:MI:SS') from dual * ERROR at line 1: ORA-01843: not a valid month PG: postgres=# SELECT TO_TIMESTAMP('2016-06-13 99:99:99', 'YYYYMMDD HH24:MI:SS'); to_timestamp ------------------------ 2016-01-06 14:40:39+03 (1 row) I know about: "These functions interpret input liberally, with minimal error checking. While they produce valid output, the conversion can yield unexpected results" from docs but by providing illegal input parameters we have no any exceptions or errors about that. I think that to_timestamp() need to has more format checking than it has now. Alex Ignatov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company
В списке pgsql-hackers по дате отправления: