Re: Junk date getting uploaded into date field
От | Albe Laurenz |
---|---|
Тема | Re: Junk date getting uploaded into date field |
Дата | |
Msg-id | A737B7A37273E048B164557ADEF4A58B17C56D0F@ntex2010i.host.magwien.gv.at обсуждение исходный текст |
Ответ на | Re: Junk date getting uploaded into date field (Steve Crawford <scrawford@pinpointresearch.com>) |
Список | pgsql-general |
Steve Crawford wrote: >> There is a comment in utils/adt/formatting.c: >> >> * This function does very little error checking, e.g. >> * to_timestamp('20096040','YYYYMMDD') works >> >> > I think the place for such warnings in addition to the source-code is in > the documentation. This or similar issues with to_date have popped up on > the lists a number of times. > > Perhaps a "see warnings below" by the to_date description in table: > http://www.postgresql.org/docs/9.3/static/functions-formatting.html#FUNCTIONS-FORMATTING-TABLE > > Then under usage notes something like: > > The to_date and to_timestamp functions do minimal input error-checking > and are intended for conversion of non-standard formats that cannot be > handled by casting. These functions will attempt to convert illegal > dates to the best of their ability, e.g. to_date('33-OCT-2013', > 'dd-mon-yyyy') will return 2013-11-02. Users of these functions are > advised to perform whatever external error-checking they deem prudent. I like that. Would you write a patch and add it to the commitfest? Yours, Laurenz Albe
В списке pgsql-general по дате отправления: