to_char() accepting invalid dates?

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

Hi,

I just noticed that to_char() will "accept" invalid dates such as 2011-02-31 and "adjust" them accordingly:

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?

Regards
Thomas

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Jasen Betts 2011-07-18 09:23:27 Re: to_char() accepting invalid dates?
Previous Message Craig Ringer 2011-07-14 23:40:11 Re: Looking for a "show create table <name>" equivalent