pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedTO_DATE Function unintended behavior when month value is greater than 12
10+ messages / 7 participants
[nested] [flat]
* TO_DATE Function unintended behavior when month value is greater than 12
@ 2018-03-01 18:34 naidu rongali <rongalinaidu@gmail.com>
0 siblings, 2 replies; 10+ messages in thread
From: naidu rongali @ 2018-03-01 18:34 UTC (permalink / raw)
To: pgsql-bugs
Hi,
I noticed this behavior on recent release of PG database. It will be
helpful to users, if this behavior is looked into.
When executed below SQL, got unintended output when i expected it to throw
error " not a valid month "
SQL executed:
select to_date('20171231','YYYYDDMM')
result:
2019-07-17
Thank you, Naidu
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: TO_DATE Function unintended behavior when month value is greater than 12
@ 2018-03-01 19:26 Pavel Stehule <pavel.stehule@gmail.com>
parent: naidu rongali <rongalinaidu@gmail.com>
1 sibling, 0 replies; 10+ messages in thread
From: Pavel Stehule @ 2018-03-01 19:26 UTC (permalink / raw)
To: naidu rongali <rongalinaidu@gmail.com>; +Cc: pgsql-bugs
2018-03-01 19:34 GMT+01:00 naidu rongali <rongalinaidu@gmail.com>:
> Hi,
> I noticed this behavior on recent release of PG database. It will be
> helpful to users, if this behavior is looked into.
>
> When executed below SQL, got unintended output when i expected it to throw
> error " not a valid month "
>
> SQL executed:
> select to_date('20171231','YYYYDDMM')
>
> result:
> 2019-07-17
>
What is your version?
It should be fixed on PostgreSQL 10 and higher (there was not backport
because some applications used this feature)
Regards
Pavel
>
>
> Thank you, Naidu
>
^ permalink raw reply [nested|flat] 10+ messages in thread
* RE: TO_DATE Function unintended behavior when month value is greater than 12
@ 2018-03-01 19:28 Igor Neyman <ineyman@perceptron.com>
parent: naidu rongali <rongalinaidu@gmail.com>
1 sibling, 1 reply; 10+ messages in thread
From: Igor Neyman @ 2018-03-01 19:28 UTC (permalink / raw)
To: naidu rongali <rongalinaidu@gmail.com>; pgsql-bugs
From: naidu rongali [mailto:rongalinaidu@gmail.com]
Sent: Thursday, March 01, 2018 1:34 PM
To: pgsql-bugs@postgresql.org
Subject: TO_DATE Function unintended behavior when month value is greater than 12
Attention: This email was sent from someone outside of Perceptron. Always exercise caution when opening attachments or clicking links from unknown senders or when receiving unexpected emails.
Hi,
I noticed this behavior on recent release of PG database. It will be helpful to users, if this behavior is looked into.
When executed below SQL, got unintended output when i expected it to throw error " not a valid month "
SQL executed:
select to_date('20171231','YYYYDDMM')
result:
2019-07-17
Thank you, Naidu
I get this:
ERROR: date/time field value out of range: "20171231" SQL state: 22008
Regards,
Igor Neyman
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: TO_DATE Function unintended behavior when month value is greater than 12
@ 2018-03-01 19:40 Pantelis Theodosiou <ypercube@gmail.com>
parent: Igor Neyman <ineyman@perceptron.com>
0 siblings, 1 reply; 10+ messages in thread
From: Pantelis Theodosiou @ 2018-03-01 19:40 UTC (permalink / raw)
To: Igor Neyman <ineyman@perceptron.com>; +Cc: naidu rongali <rongalinaidu@gmail.com>; pgsql-bugs
On Thu, Mar 1, 2018 at 7:28 PM, Igor Neyman <ineyman@perceptron.com> wrote:
>
>
> *From:* naidu rongali [mailto:rongalinaidu@gmail.com]
> *Sent:* Thursday, March 01, 2018 1:34 PM
> *To:* pgsql-bugs@postgresql.org
> *Subject:* TO_DATE Function unintended behavior when month value is
> greater than 12
>
>
>
> *Attention: This email was sent from someone outside of Perceptron. Always
> exercise caution when opening attachments or clicking links from unknown
> senders or when receiving unexpected emails.*
>
>
>
> Hi,
>
> I noticed this behavior on recent release of PG database. It will be
> helpful to users, if this behavior is looked into.
>
>
>
> When executed below SQL, got unintended output when i expected it to throw
> error " not a valid month "
>
>
>
> SQL executed:
> select to_date('20171231','YYYYDDMM')
>
> result:
> 2019-07-17
>
>
>
>
>
> Thank you, Naidu
>
>
>
> I get this:
>
> ERROR: date/time field value out of range: "20171231" SQL state: 22008
>
>
>
> Regards,
>
> Igor Neyman
>
>
>
The error is thrown in version 10 but I get the wrong results in versions
9.3 to 9.6, both in the almost latest (9.3.21, 9.4.16, 9.5.11 and 9.6.7)
and today's releases (9.3.22, ..., 9.6.8)
Pantelis Theodosiou
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: TO_DATE Function unintended behavior when month value is greater than 12
@ 2018-03-01 19:43 David G. Johnston <david.g.johnston@gmail.com>
parent: Pantelis Theodosiou <ypercube@gmail.com>
0 siblings, 1 reply; 10+ messages in thread
From: David G. Johnston @ 2018-03-01 19:43 UTC (permalink / raw)
To: Pantelis Theodosiou <ypercube@gmail.com>; +Cc: Igor Neyman <ineyman@perceptron.com>; naidu rongali <rongalinaidu@gmail.com>; pgsql-bugs
>
>
> The error is thrown in version 10 but I get the wrong results in versions
> 9.3 to 9.6, both in the almost latest (9.3.21, 9.4.16, 9.5.11 and 9.6.7)
> and today's releases (9.3.22, ..., 9.6.8)
>
>
As Pavel said we fixed this in 10 but did not back-patch the behavior
change.
David J.
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: TO_DATE Function unintended behavior when month value is greater than 12
@ 2018-03-02 03:28 naidu rongali <rongalinaidu@gmail.com>
parent: David G. Johnston <david.g.johnston@gmail.com>
0 siblings, 1 reply; 10+ messages in thread
From: naidu rongali @ 2018-03-02 03:28 UTC (permalink / raw)
To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: Pantelis Theodosiou <ypercube@gmail.com>; Igor Neyman <ineyman@perceptron.com>; pgsql-bugs
Thank you all for the update. I checked the version details. it is
"PostgreSQL 8.0.2".
On Fri, Mar 2, 2018 at 1:13 AM, David G. Johnston <
david.g.johnston@gmail.com> wrote:
>
>> The error is thrown in version 10 but I get the wrong results in versions
>> 9.3 to 9.6, both in the almost latest (9.3.21, 9.4.16, 9.5.11 and 9.6.7)
>> and today's releases (9.3.22, ..., 9.6.8)
>>
>>
> As Pavel said we fixed this in 10 but did not back-patch the behavior
> change.
>
> David J.
>
>
^ permalink raw reply [nested|flat] 10+ messages in thread
* TO_DATE Function unintended behavior when month value is greater than 12
@ 2018-03-02 03:47 David G. Johnston <david.g.johnston@gmail.com>
parent: naidu rongali <rongalinaidu@gmail.com>
0 siblings, 1 reply; 10+ messages in thread
From: David G. Johnston @ 2018-03-02 03:47 UTC (permalink / raw)
To: naidu rongali <rongalinaidu@gmail.com>; +Cc: Pantelis Theodosiou <ypercube@gmail.com>; Igor Neyman <ineyman@perceptron.com>; pgsql-bugs
On Thursday, March 1, 2018, naidu rongali <rongalinaidu@gmail.com> wrote:
> Thank you all for the update. I checked the version details. it is
> "PostgreSQL 8.0.2".
>
If that database is at all important to anyone it needs serious
professional attention. It doesn't qualify as "recent" no matter how
liberal you wish to make the definition.
David J.
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: TO_DATE Function unintended behavior when month value is greater than 12
@ 2018-03-02 04:00 Tom Lane <tgl@sss.pgh.pa.us>
parent: David G. Johnston <david.g.johnston@gmail.com>
0 siblings, 2 replies; 10+ messages in thread
From: Tom Lane @ 2018-03-02 04:00 UTC (permalink / raw)
To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: naidu rongali <rongalinaidu@gmail.com>; Pantelis Theodosiou <ypercube@gmail.com>; Igor Neyman <ineyman@perceptron.com>; pgsql-bugs
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Thursday, March 1, 2018, naidu rongali <rongalinaidu@gmail.com> wrote:
>> Thank you all for the update. I checked the version details. it is
>> "PostgreSQL 8.0.2".
> If that database is at all important to anyone it needs serious
> professional attention. It doesn't qualify as "recent" no matter how
> liberal you wish to make the definition.
To quantify that: 8.0.2 was released on 2005-04-07, and was obsoleted
by 8.0.3 on 2005-05-09. See release notes at
https://www.postgresql.org/docs/8.0/static/release.html
regards, tom lane
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: TO_DATE Function unintended behavior when month value is greater than 12
@ 2018-03-02 14:09 David G. Johnston <david.g.johnston@gmail.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 0 replies; 10+ messages in thread
From: David G. Johnston @ 2018-03-02 14:09 UTC (permalink / raw)
To: naidu rongali <rongalinaidu@gmail.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Pantelis Theodosiou <ypercube@gmail.com>; Igor Neyman <ineyman@perceptron.com>; pgsql-bugs
On Fri, Mar 2, 2018 at 6:52 AM, naidu rongali <rongalinaidu@gmail.com>
wrote:
> though 8.2 is in deprecated versions, looks like 8.0.2 is released on
> 2009-02-02 as per https://www.postgresql.org/docs/8.0/static/release-8-0-
> 20.html
>
>
That link points to 8.0.20 not 8.0.2 ... it would less egregious if
running 8.0.26 since at least you would have been running the most
up-to-date version of the 8.0 major release series but even that is over 7
years old at this point.
8.2[.x] is a completely different major version.
Upgrading 8.0 to a late 9 series or current 10 release will be non-trivial
but, IMO, the decision not to should be a done with the consent and
understanding of whomever ultimately owns the database and not through
inattention.
David J.
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: TO_DATE Function unintended behavior when month value is greater than 12
@ 2018-03-02 20:51 Andrew Gierth <andrew@tao11.riddles.org.uk>
parent: Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 0 replies; 10+ messages in thread
From: Andrew Gierth @ 2018-03-02 20:51 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: David G. Johnston <david.g.johnston@gmail.com>; naidu rongali <rongalinaidu@gmail.com>; Pantelis Theodosiou <ypercube@gmail.com>; Igor Neyman <ineyman@perceptron.com>; pgsql-bugs
>>>>> "Tom" == Tom Lane <tgl@sss.pgh.pa.us> writes:
>>> Thank you all for the update. I checked the version details. it is
>>> "PostgreSQL 8.0.2".
>> If that database is at all important to anyone it needs serious
>> professional attention. It doesn't qualify as "recent" no matter how
>> liberal you wish to make the definition.
Tom> To quantify that: 8.0.2 was released on 2005-04-07, and was obsoleted
Tom> by 8.0.3 on 2005-05-09. See release notes at
Tom> https://www.postgresql.org/docs/8.0/static/release.html
It's probably not postgresql at all; Amazon Redshift identifies itself
as pg 8.0.2, even though it supports a lot of more recent stuff as well.
--
Andrew (irc:RhodiumToad)
^ permalink raw reply [nested|flat] 10+ messages in thread
end of thread, other threads:[~2018-03-02 20:51 UTC | newest]
Thread overview: 10+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-03-01 18:34 TO_DATE Function unintended behavior when month value is greater than 12 naidu rongali <rongalinaidu@gmail.com>
2018-03-01 19:26 ` Pavel Stehule <pavel.stehule@gmail.com>
2018-03-01 19:28 ` Igor Neyman <ineyman@perceptron.com>
2018-03-01 19:40 ` Pantelis Theodosiou <ypercube@gmail.com>
2018-03-01 19:43 ` David G. Johnston <david.g.johnston@gmail.com>
2018-03-02 03:28 ` naidu rongali <rongalinaidu@gmail.com>
2018-03-02 03:47 ` David G. Johnston <david.g.johnston@gmail.com>
2018-03-02 04:00 ` Tom Lane <tgl@sss.pgh.pa.us>
2018-03-02 14:09 ` David G. Johnston <david.g.johnston@gmail.com>
2018-03-02 20:51 ` Andrew Gierth <andrew@tao11.riddles.org.uk>
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