Re: to_char() accepting invalid dates?

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: to_char() accepting invalid dates?
Date: 2011-07-18 17:07:43
Message-ID: j01p8u$qjl$1@dough.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Jasen Betts wrote on 18.07.2011 11:23:
>> postgres=> select to_date('20110231', 'yyyymmdd');
>>
>> to_date
>> ------------
>> 2011-03-03
>> (1 row)
>>
>> is there a way to have to_date() raise an exception in such a case?
>
> it's possible the odd behaviour you get is required by some standard.

That would be *very* odd indeed.

> jasen=# select '20110303'::date;
Thanks for the tip, this was more a question regarding _why_ to_char() behaves this way.

Thomas

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Bruce Momjian 2011-07-18 22:02:27 Re: to_char() accepting invalid dates?
Previous Message Jasen Betts 2011-07-18 09:23:27 Re: to_char() accepting invalid dates?