Re: [HACKERS] to_date_valid()

2016-09-27 Thread Tom Lane
Peter Eisentraut writes: > I think using ValidateDate() was the right idea. That is what we use > for checking date validity everywhere else. Note that we've got two different CF entries, and threads, covering fundamentally the same territory here, ie making

Re: [HACKERS] to_date_valid()

2016-09-21 Thread Peter Eisentraut
On 9/9/16 4:48 AM, Andreas 'ads' Scherbaum wrote: > ValidateDate() will tell you if it's a valid date. But not if the > transformation was correct: > > postgres=# SELECT to_date('2011 12 18', ' MM DD'); >to_date > > 2011-12-08 > (1 row) > > (with the patch from Artur)

Re: [HACKERS] to_date_valid()

2016-09-09 Thread Andreas 'ads' Scherbaum
On 08.09.2016 17:31, Peter Eisentraut wrote: On 8/15/16 7:33 AM, Andreas 'ads' Scherbaum wrote: postgres=# SELECT to_date('2011 12 18', ' MM DD'); to_date 2011-12-08 (1 row) That is from the regression tests, and obviously handles the date transformation wrong. My

Re: [HACKERS] to_date_valid()

2016-09-08 Thread Peter Eisentraut
On 8/15/16 7:33 AM, Andreas 'ads' Scherbaum wrote: > postgres=# SELECT to_date('2011 12 18', ' MM DD'); >to_date > > 2011-12-08 > (1 row) > > > That is from the regression tests, and obviously handles the date > transformation wrong. My attempt catches this, because I

Re: [HACKERS] to_date_valid()

2016-08-15 Thread Andreas 'ads' Scherbaum
On 15.08.2016 13:44, Artur Zakirov wrote: On 15.08.2016 14:33, Andreas 'ads' Scherbaum wrote: Is it right and "true" way to validate date by extra transforming and comparison? Maybe validate date by using ValidateDate(). Attached sample patch. This does not solve the problem at hand, and

Re: [HACKERS] to_date_valid()

2016-08-15 Thread Artur Zakirov
On 15.08.2016 14:33, Andreas 'ads' Scherbaum wrote: Is it right and "true" way to validate date by extra transforming and comparison? Maybe validate date by using ValidateDate(). Attached sample patch. This does not solve the problem at hand, and let's wrong dates/formats slip through:

Re: [HACKERS] to_date_valid()

2016-08-15 Thread Andreas 'ads' Scherbaum
On 15.08.2016 10:24, Artur Zakirov wrote: On 14.08.2016 01:52, Andreas 'ads' Scherbaum wrote: Attached is a patch to "do the right thing". The verification is in "to_date()" now, the extra function is removed. Regression tests are updated - two or three of them returned a wrong date before,

Re: [HACKERS] to_date_valid()

2016-08-15 Thread Artur Zakirov
On 14.08.2016 01:52, Andreas 'ads' Scherbaum wrote: Attached is a patch to "do the right thing". The verification is in "to_date()" now, the extra function is removed. Regression tests are updated - two or three of them returned a wrong date before, and still passed. They fail now.

Re: [HACKERS] to_date_valid()

2016-08-13 Thread Andreas 'ads' Scherbaum
On 27.07.2016 05:00, Joshua D. Drake wrote: On 07/26/2016 06:25 PM, Peter Eisentraut wrote: On 7/5/16 4:24 AM, Albe Laurenz wrote: But notwithstanding your feeling that you would like your application to break if it makes use of this behaviour, it is a change that might make some people pretty

Re: [HACKERS] to_date_valid()

2016-07-29 Thread Jim Nasby
On 7/29/16 1:33 PM, Andreas 'ads' Scherbaum wrote: On 27.07.2016 05:00, Joshua D. Drake wrote: On 07/26/2016 06:25 PM, Peter Eisentraut wrote: On 7/5/16 4:24 AM, Albe Laurenz wrote: But notwithstanding your feeling that you would like your application to break if it makes use of this

Re: [HACKERS] to_date_valid()

2016-07-29 Thread Andreas 'ads' Scherbaum
On 27.07.2016 05:00, Joshua D. Drake wrote: On 07/26/2016 06:25 PM, Peter Eisentraut wrote: On 7/5/16 4:24 AM, Albe Laurenz wrote: But notwithstanding your feeling that you would like your application to break if it makes use of this behaviour, it is a change that might make some people pretty

Re: [HACKERS] to_date_valid()

2016-07-26 Thread Joshua D. Drake
On 07/26/2016 06:25 PM, Peter Eisentraut wrote: On 7/5/16 4:24 AM, Albe Laurenz wrote: But notwithstanding your feeling that you would like your application to break if it makes use of this behaviour, it is a change that might make some people pretty unhappy - nobody can tell how many. What

Re: [HACKERS] to_date_valid()

2016-07-26 Thread Peter Eisentraut
On 7/5/16 4:24 AM, Albe Laurenz wrote: > But notwithstanding your feeling that you would like your application > to break if it makes use of this behaviour, it is a change that might > make some people pretty unhappy - nobody can tell how many. What is the use of the existing behavior? You get

Re: [HACKERS] to_date_valid()

2016-07-26 Thread Bruce Momjian
On Tue, Jul 5, 2016 at 07:41:15AM -0400, David G. Johnston wrote: > ​Surely these beta testers would test against the RC before putting it into > production so I don't see an issue.  I tend to agree generally but the point > of > beta is to find bugs and solicit suggestions for improvement to

Re: [HACKERS] to_date_valid()

2016-07-05 Thread David G. Johnston
On Tue, Jul 5, 2016 at 5:22 AM, Andreas 'ads' Scherbaum < adsm...@wars-nicht.de> wrote: > On 05.07.2016 04:33, David G. Johnston wrote: > >> On Mon, Jul 4, 2016 at 8:39 PM, Andreas 'ads' Scherbaum >> >wrote: >> >> On 04.07.2016 18:37, Pavel

Re: [HACKERS] to_date_valid()

2016-07-05 Thread Andreas 'ads' Scherbaum
On 05.07.2016 04:33, David G. Johnston wrote: On Mon, Jul 4, 2016 at 8:39 PM, Andreas 'ads' Scherbaum >wrote: On 04.07.2016 18:37, Pavel Stehule wrote: I don't know if the name "strict" is best, but the name "validate"

Re: [HACKERS] to_date_valid()

2016-07-05 Thread Andreas 'ads' Scherbaum
On 05.07.2016 06:05, Pavel Stehule wrote: 2016-07-05 2:39 GMT+02:00 Andreas 'ads' Scherbaum >: On 04.07.2016 18:37, Pavel Stehule wrote: I don't know if the name "strict" is best, but the name "validate" is not

Re: [HACKERS] to_date_valid()

2016-07-05 Thread Albe Laurenz
Andreas Karlsson wrote: > On 07/04/2016 10:55 PM, Pavel Stehule wrote: >> 2016-07-04 22:15 GMT+02:00 Andreas Karlsson wrote: >>> I do not see a clear conclusion in the linked threads. For example >>> Bruce calls it a bug in one of the emails >>>

Re: [HACKERS] to_date_valid()

2016-07-04 Thread Pavel Stehule
2016-07-05 2:39 GMT+02:00 Andreas 'ads' Scherbaum : > On 04.07.2016 18:37, Pavel Stehule wrote: > >> >> I don't know if the name "strict" is best, but the name "validate" is >> not good too. Current to_date does some validations too. >> > > Obviously not enough, because it

Re: [HACKERS] to_date_valid()

2016-07-04 Thread Pavel Stehule
2016-07-05 4:33 GMT+02:00 David G. Johnston : > On Mon, Jul 4, 2016 at 8:39 PM, Andreas 'ads' Scherbaum < > adsm...@wars-nicht.de> wrote: > >> On 04.07.2016 18:37, Pavel Stehule wrote: >> >>> >>> I don't know if the name "strict" is best, but the name "validate" is >>>

Re: [HACKERS] to_date_valid()

2016-07-04 Thread David G. Johnston
On Mon, Jul 4, 2016 at 8:39 PM, Andreas 'ads' Scherbaum < adsm...@wars-nicht.de> wrote: > On 04.07.2016 18:37, Pavel Stehule wrote: > >> >> I don't know if the name "strict" is best, but the name "validate" is >> not good too. Current to_date does some validations too. >> > > Obviously not

Re: [HACKERS] to_date_valid()

2016-07-04 Thread Andreas 'ads' Scherbaum
On 04.07.2016 18:37, Pavel Stehule wrote: I don't know if the name "strict" is best, but the name "validate" is not good too. Current to_date does some validations too. Obviously not enough, because it allows invalid dates. I'd say that the current to_date() merely validates the input format

Re: [HACKERS] to_date_valid()

2016-07-04 Thread Andreas Karlsson
On 07/04/2016 10:55 PM, Pavel Stehule wrote: 2016-07-04 22:15 GMT+02:00 Andreas Karlsson >: I do not see a clear conclusion in the linked threads. For example Bruce calls it a bug in one of the emails

Re: [HACKERS] to_date_valid()

2016-07-04 Thread Pavel Stehule
2016-07-04 22:15 GMT+02:00 Andreas Karlsson : > On 07/03/2016 12:36 PM, Andreas 'ads' Scherbaum wrote: > >> On 03.07.2016 07:05, Jaime Casanova wrote: >> >>> Shouldn't we fix this instead? Sounds like a bug to me. We don't usually >>> want to be bug compatible so it doesn't

Re: [HACKERS] to_date_valid()

2016-07-04 Thread Andreas Karlsson
On 07/03/2016 12:36 PM, Andreas 'ads' Scherbaum wrote: On 03.07.2016 07:05, Jaime Casanova wrote: Shouldn't we fix this instead? Sounds like a bug to me. We don't usually want to be bug compatible so it doesn't matter if we break something. There are previous discussions about such a change,

Re: [HACKERS] to_date_valid()

2016-07-04 Thread Pavel Stehule
2016-07-04 18:24 GMT+02:00 Andreas 'ads' Scherbaum : > On 04.07.2016 05:51, Pavel Stehule wrote: > >> >> >> 2016-07-04 5:19 GMT+02:00 Pavel Stehule > >: >> >> >> >> 2016-07-04 4:25 GMT+02:00 Craig Ringer

Re: [HACKERS] to_date_valid()

2016-07-04 Thread Andreas 'ads' Scherbaum
On 04.07.2016 05:51, Pavel Stehule wrote: 2016-07-04 5:19 GMT+02:00 Pavel Stehule >: 2016-07-04 4:25 GMT+02:00 Craig Ringer >: On 3 July 2016 at 09:32, Euler

Re: [HACKERS] to_date_valid()

2016-07-04 Thread Andreas 'ads' Scherbaum
On 04.07.2016 16:33, Amit Kapila wrote: On Sun, Jul 3, 2016 at 6:34 AM, Andreas 'ads' Scherbaum wrote: Hello, we have customers complaining that to_date() accepts invalid dates, and returns a different date instead. This is a known issue:

Re: [HACKERS] to_date_valid()

2016-07-04 Thread Amit Kapila
On Sun, Jul 3, 2016 at 6:34 AM, Andreas 'ads' Scherbaum wrote: > > Hello, > > we have customers complaining that to_date() accepts invalid dates, and > returns a different date instead. This is a known issue: > >

Re: [HACKERS] to_date_valid()

2016-07-03 Thread Pavel Stehule
2016-07-04 5:19 GMT+02:00 Pavel Stehule : > > > 2016-07-04 4:25 GMT+02:00 Craig Ringer : > >> On 3 July 2016 at 09:32, Euler Taveira wrote: >> >>> On 02-07-2016 22:04, Andreas 'ads' Scherbaum wrote: >>> > The attached patch

Re: [HACKERS] to_date_valid()

2016-07-03 Thread Gavin Flower
On 04/07/16 15:19, Pavel Stehule wrote: 2016-07-04 4:25 GMT+02:00 Craig Ringer >: On 3 July 2016 at 09:32, Euler Taveira > wrote: On 02-07-2016 22

Re: [HACKERS] to_date_valid()

2016-07-03 Thread Pavel Stehule
2016-07-04 4:25 GMT+02:00 Craig Ringer : > On 3 July 2016 at 09:32, Euler Taveira wrote: > >> On 02-07-2016 22:04, Andreas 'ads' Scherbaum wrote: >> > The attached patch adds a new function "to_date_valid()" which will >> > validate the date and

Re: [HACKERS] to_date_valid()

2016-07-03 Thread Craig Ringer
On 3 July 2016 at 09:32, Euler Taveira wrote: > On 02-07-2016 22:04, Andreas 'ads' Scherbaum wrote: > > The attached patch adds a new function "to_date_valid()" which will > > validate the date and return an error if the input and output date do > > not match. Tests

Re: [HACKERS] to_date_valid()

2016-07-03 Thread Andreas 'ads' Scherbaum
On 03.07.2016 07:05, Jaime Casanova wrote: El 2/7/2016 20:33, "Euler Taveira" > escribió: > > On 02-07-2016 22:04, Andreas 'ads' Scherbaum wrote: > > The attached patch adds a new function "to_date_valid()" which will > > validate the date

Re: [HACKERS] to_date_valid()

2016-07-02 Thread Jaime Casanova
El 2/7/2016 20:33, "Euler Taveira" escribió: > > On 02-07-2016 22:04, Andreas 'ads' Scherbaum wrote: > > The attached patch adds a new function "to_date_valid()" which will > > validate the date and return an error if the input and output date do > > not match. Tests

Re: [HACKERS] to_date_valid()

2016-07-02 Thread Euler Taveira
On 02-07-2016 22:04, Andreas 'ads' Scherbaum wrote: > The attached patch adds a new function "to_date_valid()" which will > validate the date and return an error if the input and output date do > not match. Tests included, documentation update as well. > Why don't you add a third parameter (say,

[HACKERS] to_date_valid()

2016-07-02 Thread Andreas 'ads' Scherbaum
Hello, we have customers complaining that to_date() accepts invalid dates, and returns a different date instead. This is a known issue: http://sql-info.de/postgresql/notes/to_date-to_timestamp-gotchas.html On the other hand this leads to wrong dates when loading dates into the database,