Re: date function bug

2019-10-23 Thread Adrian Klaver
On 10/23/19 7:55 AM, Ravi Krishna wrote: Surprisingly (to me), no…. db=# select to_date('20181501','MMDD'); 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

Re: date function bug

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

RE: date function bug

2019-10-23 Thread Kevin Brannen
From: Ravi Krishna > postgres=# select to_date('2018150X','MMDD'); > to_date > 2019-03-03 > postgres=# select to_date('20181501','MMDD'); > to_date > > 2019-03-03 is this a cut-n-paste mistake? Surprisingly (to me), no…. db=# select

Re: date function bug

2019-10-23 Thread Tom Lane
"Abraham, Danny" writes: > The function "to_date" does not fail illegal values. > Is this a known bug? No, it's a feature, because the point of to_date() is to parse strings that would be rejected or misinterpreted by the regular date input function. If you want tighter error checking and your i

RE: Re: date function bug

2019-10-23 Thread Abraham, Danny
sql.org Subject: [EXTERNAL] Re: date function bug > ctrlmdb=> select to_date('2018100X','MMDD'); > to_date >2018-10-01 >(1 row) I am able to reproduce this in 11.5 It seems PG can take a single digit for Day too. select to_date('2018109','MMDD') produces 2018-10-09.

Re: date function bug

2019-10-23 Thread Adrian Klaver
On 10/23/19 7:22 AM, Abraham, Danny wrote: Hi, The function "to_date" does not fail illegal values. Is this a known bug? What is the recommended type checking? ctrlmdb=> select to_date('2018100X','MMDD'); to_date 2018-10-01 (1 row) At: https://www.postgresql.org/docs

Re: date function bug

2019-10-23 Thread Ron
On 10/23/19 9:32 AM, Ravi Krishna wrote: > postgres=# select to_date('2018150X','MMDD');   > to_date > 2019-03-03 > postgres=# select to_date('20181501','MMDD'); >  to_date >   > 2019-03-03 is this a cut-n-paste mistake? Nope. Here's the screen print: http

Re: date function bug

2019-10-23 Thread Ravi Krishna
> postgres=# select to_date('2018150X','MMDD');   > to_date > 2019-03-03 > postgres=# select to_date('20181501','MMDD'); >  to_date >   > 2019-03-03 is this a cut-n-paste mistake?

Re: date function bug

2019-10-23 Thread Ravi Krishna
> ctrlmdb=> select to_date('2018100X','MMDD'); > to_date >2018-10-01 >(1 row) I am able to reproduce this in 11.5 It seems PG can take a single digit for Day too. select to_date('2018109','MMDD') produces 2018-10-09.

Re: date function bug

2019-10-23 Thread Ron
On 10/23/19 9:22 AM, Abraham, Danny wrote: Hi, The function "to_date" does not fail illegal values. Is this a known bug? What is the recommended type checking? ctrlmdb=> select to_date('2018100X','MMDD'); to_date 2018-10-01 (1 row) psql (9.6.15) Type "help" for help. p

date function bug

2019-10-23 Thread Abraham, Danny
Hi, The function "to_date" does not fail illegal values. Is this a known bug? What is the recommended type checking? ctrlmdb=> select to_date('2018100X','MMDD'); to_date 2018-10-01 (1 row)