Re: to_date() and invalid dates

From: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "Thomas Kellerer *EXTERN*" <spam_eater(at)gmx(dot)net>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: to_date() and invalid dates
Date: 2014-01-21 08:46:24
Message-ID: A737B7A37273E048B164557ADEF4A58B17C916E4@ntex2010i.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thomas Kellerer wrote:
>>> 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

See for example
http://www.postgresql.org/message-id/20099.1350484290@sss.pgh.pa.us
that this is known and accepted behaviour.
However,
http://www.postgresql.org/message-id/22259.1114613632@sss.pgh.pa.us
so I guess that it was not intended, but since it has been that way
for long enough it would be too painful to change it.

So actually my original answer "it is by design" is probably wrong.

"Based upon" should be read as "inspired by" rather than
"compatible with".

Yours,
Laurenz Albe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Maciej Szopinski 2014-01-21 09:34:43 Is there a way to address all elements of JSON array when creating a constraint in PosgreSQL?
Previous Message Granthana Biswas 2014-01-21 07:17:27 Re: Correct query to check streaming replication lag