Re: Junk date getting uploaded into date field

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Junk date getting uploaded into date field
Дата
Msg-id 16613.1383662754@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Junk date getting uploaded into date field  (Albe Laurenz <laurenz.albe@wien.gv.at>)
Список pgsql-general
Albe Laurenz <laurenz.albe@wien.gv.at> writes:
> There is a comment in utils/adt/formatting.c:

>  * This function does very little error checking, e.g.
>  * to_timestamp('20096040','YYYYMMDD') works

> So at least this is not by accident.

No, it isn't.  This is in fact the traditional behavior of Unix time
conversion utilities such as mktime(3).  The glibc man page gives the
specific example that "40 October" will be converted to "9 November"
rather than throwing an error.  The POSIX and C standards are not so
explicit, saying only that the inputs are not restricted to the normal
ranges (which I think would entitle an implementation to change 40
October to 31 October instead; but I've never heard of anyone doing
it that way).

            regards, tom lane


В списке pgsql-general по дате отправления:

Предыдущее
От: Patrick Dung
Дата:
Сообщение: Re: Curious question about physical files to store database
Следующее
От: Albe Laurenz
Дата:
Сообщение: Re: Curious question about physical files to store database