Re: [HACKERS] [PATH] Correct negative/zero year in to_date/to_timestamp

2016-03-11 Thread Vitaly Burovoy
On 3/11/16, Tom Lane wrote: > [ catches up with thread... ] > > Yes. It would be more reasonable IMO for to_date to throw an error > because this is bad input. On the other hand, to_date mostly doesn't > throw an error no matter how bad the input is. I think that may have > been intentional, al

Re: [HACKERS] [PATH] Correct negative/zero year in to_date/to_timestamp

2016-03-11 Thread Tom Lane
Robert Haas writes: > On Sun, Feb 28, 2016 at 9:38 PM, Vitaly Burovoy > wrote: >>> However, I'm not sure we ought to tinker with the behavior in this >>> area. If -MM-DD is going to accept things that are not of the >>> format -MM-DD, and I'd argue that -1-06-01 is not in that format, >

Re: [HACKERS] [PATH] Correct negative/zero year in to_date/to_timestamp

2016-03-11 Thread Vitaly Burovoy
On 3/11/16, Robert Haas wrote: > On Sun, Feb 28, 2016 at 9:38 PM, Vitaly Burovoy > wrote: >>> However, I'm not sure we ought to tinker with the behavior in this >>> area. If -MM-DD is going to accept things that are not of the >>> format -MM-DD, and I'd argue that -1-06-01 is not in that

Re: [HACKERS] [PATH] Correct negative/zero year in to_date/to_timestamp

2016-03-11 Thread Robert Haas
On Sun, Feb 28, 2016 at 9:38 PM, Vitaly Burovoy wrote: >> However, I'm not sure we ought to tinker with the behavior in this >> area. If -MM-DD is going to accept things that are not of the >> format -MM-DD, and I'd argue that -1-06-01 is not in that format, > > It is not about format, it

Re: [HACKERS] [PATH] Correct negative/zero year in to_date/to_timestamp

2016-02-28 Thread Vitaly Burovoy
On 2/27/16, Robert Haas wrote: > On Tue, Feb 23, 2016 at 6:23 AM, Thomas Munro > wrote: >> This seems to be a messy topic. The usage of "AD" and "BC" imply that >> TO_DATE is using the anno domini system which doesn't have a year 0, >> but in the DATE type perhaps we are using the ISO 8601 model

Re: [HACKERS] [PATH] Correct negative/zero year in to_date/to_timestamp

2016-02-28 Thread Yury Zhuravlev
But I'm waiting for a discussion: what part should be changed? I for compliance with the standard (all ISO). In addition Oracle uses "IYYY" format. Standards allow to reduce liability. But I think someone like Tom Lane can have the final say because we break backward compatibility. Options "y

Re: [HACKERS] [PATH] Correct negative/zero year in to_date/to_timestamp

2016-02-27 Thread Robert Haas
On Tue, Feb 23, 2016 at 6:23 AM, Thomas Munro wrote: > This seems to be a messy topic. The usage of "AD" and "BC" imply that > TO_DATE is using the anno domini system which doesn't have a year 0, > but in the DATE type perhaps we are using the ISO 8601 model[2] where > 1 BC is represented as

Re: [HACKERS] [PATH] Correct negative/zero year in to_date/to_timestamp

2016-02-26 Thread Vitaly Burovoy
On 2/26/16, Shulgin, Oleksandr wrote: > On Fri, Feb 26, 2016 at 3:24 PM, Ivan Kartyshov > > wrote: > >> The following review has been posted through the commitfest application: > >> make installcheck-world: tested, failed >> Implements feature: tested, failed >> Spec compliant: t

Re: [HACKERS] [PATH] Correct negative/zero year in to_date/to_timestamp

2016-02-26 Thread Ivan Kartyshov
> Why does it say "tested, failed" for all points above there? ;-) Hi, I just used Web reviewer form on https://commitfest.postgresql.org to make review on patch, but form doesn't work properly unlike the patch.))

Re: [HACKERS] [PATH] Correct negative/zero year in to_date/to_timestamp

2016-02-26 Thread Shulgin, Oleksandr
On Fri, Feb 26, 2016 at 3:24 PM, Ivan Kartyshov wrote: > The following review has been posted through the commitfest application: > > make installcheck-world: tested, failed > Implements feature: tested, failed > Spec compliant: tested, failed > Documentation:tested

Re: [HACKERS] [PATH] Correct negative/zero year in to_date/to_timestamp

2016-02-26 Thread Ivan Kartyshov
The following review has been posted through the commitfest application: make installcheck-world: tested, failed Implements feature: tested, failed Spec compliant: tested, failed Documentation:tested, failed Applied this patch, it works well, make what it expected corr

Re: [HACKERS] [PATH] Correct negative/zero year in to_date/to_timestamp

2016-02-22 Thread Vitaly Burovoy
On 2/22/16, Thomas Munro wrote: > On Tue, Feb 23, 2016 at 11:58 AM, Vitaly Burovoy > wrote: >> Hello, Hackers! >> >> I'm writing another patch and while I was trying to cover corner cases >> I found that to_date and to_timestamp work wrong if year in input >> value is zero or negative: >> >> post

Re: [HACKERS] [PATH] Correct negative/zero year in to_date/to_timestamp

2016-02-22 Thread Thomas Munro
On Tue, Feb 23, 2016 at 11:58 AM, Vitaly Burovoy wrote: > Hello, Hackers! > > I'm writing another patch and while I was trying to cover corner cases > I found that to_date and to_timestamp work wrong if year in input > value is zero or negative: > > postgres=# SELECT > postgres-# y || '-06-01

Re: [HACKERS] [PATH] Correct negative/zero year in to_date/to_timestamp

2016-02-22 Thread Vitaly Burovoy
On 2/22/16, Vitaly Burovoy wrote: > Testings, complains, advice, comment improvements are very appreciated. The patch seems simple, but it can lead to a discussion, so I've added it to CF. [CF]https://commitfest.postgresql.org/9/533/ -- Best regards, Vitaly Burovoy -- Sent via pgsql-hackers

[HACKERS] [PATH] Correct negative/zero year in to_date/to_timestamp

2016-02-22 Thread Vitaly Burovoy
Hello, Hackers! I'm writing another patch and while I was trying to cover corner cases I found that to_date and to_timestamp work wrong if year in input value is zero or negative: postgres=# SELECT postgres-# y || '-06-01' as src postgres-# ,CASE WHEN y>0 THEN ('00'||y||'-06-01') WHEN y<