pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-sql@postgresql.org
Subject: to_char() accepting invalid dates?
Date: Mon, 18 Jul 2011 10:22:51 +0200
Message-ID: <j00qg6$lvf$1@dough.gmane.org> (raw)

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




view thread (9+ messages)  latest in thread

Message-ID: <j00qg6$lvf$1@dough.gmane.org>
Permalink:  ../j00qg6$lvf$1@dough.gmane.org/
Also on:    postgresql.org/message-id/j00qg6$lvf$1@dough.gmane.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: spam_eater@gmx.net
  Subject: Re: to_char() accepting invalid dates?
  In-Reply-To: <j00qg6$lvf$1@dough.gmane.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox