Skip site navigation (1) Skip section navigation (2)

to_date() and invalid dates

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: to_date() and invalid dates
Date: 2014-01-20 13:44:34
Message-ID: lbj97l$cc$1@ger.gmane.org (view raw, whole thread or download thread mbox)
Thread:
Lists: pgsql-general
Hi,

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)


However in the release notes of 9.2.3[1] it is mentioned that 

  - Reject out-of-range dates in to_date() (Hitoshi Harada)

I tried the above statement using 9.2.6 and 9.3.2 in both versions 2013-02-03 is returned instead of rejecting the input. 
The same is true if e.g. an invalid month is specified: to_date('2013-17-09', 'yyyy-mm-dd').

Does this check need a configuration setting to be in effect? 

Regards
Thomas
 

[1] http://www.postgresql.org/docs/9.2/static/release-9-2-3.html



Responses

pgsql-general by date

Next:From: Albe LaurenzDate: 2014-01-20 14:29:27
Subject: Re: to_date() and invalid dates
Previous:From: Leonardo M. RaméDate: 2014-01-20 13:21:25
Subject: Filtering queries by IP

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group