Re: Junk date getting uploaded into date field

From: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "Steve Crawford *EXTERN*" <scrawford(at)pinpointresearch(dot)com>, "Thomas Kellerer *EXTERN*" <spam_eater(at)gmx(dot)net>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Junk date getting uploaded into date field
Date: 2013-11-06 08:44:54
Message-ID: A737B7A37273E048B164557ADEF4A58B17C56D0F@ntex2010i.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Massimo Ortensi 2013-11-06 08:56:22 Where can I find the 9.3 beta1 rpm now ?
Previous Message Albe Laurenz 2013-11-06 08:13:26 Re: WITH RECURSIVE doesn't work properly for me