pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Ravi Krishna <sr_krishna@aol.com>
To: Kevin Brannen <KBrannen@efji.com>
Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: date function bug
Date: Wed, 23 Oct 2019 09:31:51 -0700
Message-ID: <f4b30601-5980-cf44-a83a-59b6332d2de0@aklaver.com> (raw)
In-Reply-To: <65E4A378-AC45-4157-B59B-026B132B1A43@aol.com>
References: <0bac35bcde6747e485bc7468c4080798@phx-exmbprd-01.adprod.bmc.com>
	<a4d04d62-f166-7b91-6e0a-66e06864c2c0@gmail.com>
	<1793586722.3867823.1571841150028@mail.yahoo.com>
	<DM6PR19MB3451B74FE5D084C0B2F08612A46B0@DM6PR19MB3451.namprd19.prod.outlook.com>
	<65E4A378-AC45-4157-B59B-026B132B1A43@aol.com>

On 10/23/19 7:55 AM, Ravi Krishna wrote:
>>
>> ====================
>>
>> Surprisingly (to me), no….
>>
>> db=# select to_date('20181501','YYYYMMDD');
>>   to_date
>> ------------
>> 2019-03-03
> 
> The above fails in 11.5     SQL Error [22008]: ERROR: date/time field value out of range: "20181501"
> 

Behavior changed in v10:

https://www.postgresql.org/docs/10/release-10.html
"

Make to_timestamp() and to_date() reject out-of-range input fields 
(Artur Zakirov)

For example, previously to_date('2009-06-40','YYYY-MM-DD') was accepted 
and returned 2009-07-10. It will now generate an error.
"

-- 
Adrian Klaver
adrian.klaver@aklaver.com





view thread (11+ messages)

Message-ID: <f4b30601-5980-cf44-a83a-59b6332d2de0@aklaver.com>
Permalink:  ../f4b30601-5980-cf44-a83a-59b6332d2de0@aklaver.com/
Also on:    postgresql.org/message-id/f4b30601-5980-cf44-a83a-59b6332d2de0@aklaver.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, sr_krishna@aol.com, KBrannen@efji.com
  Subject: Re: date function bug
  In-Reply-To: <f4b30601-5980-cf44-a83a-59b6332d2de0@aklaver.com>
  References: <0bac35bcde6747e485bc7468c4080798@phx-exmbprd-01.adprod.bmc.com> <a4d04d62-f166-7b91-6e0a-66e06864c2c0@gmail.com> <1793586722.3867823.1571841150028@mail.yahoo.com> <DM6PR19MB3451B74FE5D084C0B2F08612A46B0@DM6PR19MB3451.namprd19.prod.outlook.com> <65E4A378-AC45-4157-B59B-026B132B1A43@aol.com> <f4b30601-5980-cf44-a83a-59b6332d2de0@aklaver.com>

* 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