Re: to_date() and invalid dates

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: to_date() and invalid dates
Date: 2014-01-20 15:23:55
Message-ID: lbjf1v$a2v$1@ger.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Kellerer 2014-01-20 15:32:38 Re: to_date() and invalid dates
Previous Message Adrian Klaver 2014-01-20 15:18:39 Re: incrementing without violating a constraint