Re: date function bug
От | Tom Lane |
---|---|
Тема | Re: date function bug |
Дата | |
Msg-id | 21348.1571841892@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | date function bug ("Abraham, Danny" <danny_abraham@bmc.com>) |
Список | pgsql-general |
"Abraham, Danny" <danny_abraham@bmc.com> writes: > The function "to_date" does not fail illegal values. > Is this a known bug? No, it's a feature, because the point of to_date() is to parse strings that would be rejected or misinterpreted by the regular date input function. If you want tighter error checking and your input is supposed to follow a common format, just cast the string to date. regression=# select '2018100X'::date; ERROR: invalid input syntax for type date: "2018100X" LINE 1: select '2018100X'::date; ^ regression=# select '20181501'::date; ERROR: date/time field value out of range: "20181501" LINE 1: select '20181501'::date; ^ HINT: Perhaps you need a different "datestyle" setting. regression=# select '20181001'::date; date ------------ 2018-10-01 (1 row) regards, tom lane
В списке pgsql-general по дате отправления: