Strange behaviour of to_date()
От | Mario Weilguni |
---|---|
Тема | Strange behaviour of to_date() |
Дата | |
Msg-id | 01041719461900.00830@wotan обсуждение исходный текст |
Ответы |
Re: Strange behaviour of to_date()
|
Список | pgsql-hackers |
I noticed a quite strange behaviour of to_char() in 7.0 and 7.1. It treats abbreveated forms of a date completely wrong. Example: -- this one is ok mario=# select to_date('04.01.2001', 'dd.mm.yyyy'); to_date ------------2001-01-04 -- this is completly wrong, but NO error raised mario=# select to_date('4.01.2001', 'dd.mm.yyyy'); to_date ------------0001-01-04 -- completly wrong as well mario=# select to_date('4.1.2001', 'dd.mm.yyyy'); to_date ------------0001-01-04 IMO to_date() should either recognize the date, even if shorter than the mask (Oracle compatible), or raise an error. Currently it gives completly wrong results, which is the worst option. I tried to fix this myself, but I'm lost within backend/utils/adt/formatting.c -- ===================================================Mario Weilguni KPNQwest Austria GmbH Senior Engineer Web Solutions Nikolaiplatz 4 tel: +43-316-813824 8020 graz, austria fax: +43-316-813824-26 http://www.kpnqwest.at e-mail: mario.weilguni@kpnqwest.com ===================================================
В списке pgsql-hackers по дате отправления: