From: Bruce Momjian <bruce@momjian.us>
To: Thomas Kellerer <spam_eater@gmx.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: to_char() accepting invalid dates?
Date: Mon, 18 Jul 2011 18:02:27 -0400 (EDT)
Message-ID: <201107182202.p6IM2Ri03591@momjian.us> (raw)
In-Reply-To: <j01p8u$qjl$1@dough.gmane.org>
Thomas Kellerer wrote:
> 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.
Well, to_char() is based on Oracle's to_char(). How does Oracle handle
such a date?
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ It's impossible for everything to be true. +
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: bruce@momjian.us, spam_eater@gmx.net
Subject: Re: to_char() accepting invalid dates?
In-Reply-To: <201107182202.p6IM2Ri03591@momjian.us>
* 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