Re: to_date() and invalid dates - Mailing list pgsql-general

From Thomas Kellerer
Subject Re: to_date() and invalid dates
Date
Msg-id lbjf1v$a2v$1@ger.gmane.org
Whole thread Raw
In response to Re: to_date() and invalid dates  (Albe Laurenz <laurenz.albe@wien.gv.at>)
Responses Re: to_date() and invalid dates
List pgsql-general
Albe Laurenz, 20.01.2014 15:29:
>> I asked this a while back already:
>>
>>    select to_date('2013-02-31', 'yyyy-mm-dd');
>>
>> will not generate an error (unlike e.g. Oracle)
>
> This is by design.

When I previously asked this question the answer as "this is based on Oracle's to_date()":
http://postgresql.1045698.n5.nabble.com/to-char-accepting-invalid-dates-td4598597.html#a4608551

Oracle rejects such a date, so this is highly irritating for users coming from Oracle.

>> However in the release notes of 9.2.3[1] it is mentioned that
>>
>>   - Reject out-of-range dates in to_date() (Hitoshi Harada)
>>
> This commit only rejects dates that are before 4713 BC and 5874898 AD,
> which cannot be printed reasonably.

Ah, then the comment is somewhat misleading, thanks for the clarification.


Regards
Thomas


pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: incrementing without violating a constraint
Next
From: Thomas Kellerer
Date:
Subject: Re: to_date() and invalid dates