Re: [BUGS] BUG #4862: different results in to_date() between 8.3.7 & 8.4.RC1

2009-06-24 Thread Jeremy Ford
I've just compiled and run the 8.4.RC2 code. For both of the following queries I get "0009-03-01" SELECT to_date(' 2009 03', ' MM') as extraspace; --returns "0009-03-01" SELECT to_date('2009 03', ' MM') as bogusspace; --returns "0009-03-01" Was it the intention to imitate Oracle behavi

Re: [BUGS] BUG #4862: different results in to_date() between 8.3.7 & 8.4.RC1

2009-06-24 Thread Brendan Jurd
2009/6/24 Jeremy Ford : > I've just compiled and run the 8.4.RC2 code. For both of the following > queries I get "0009-03-01" > > SELECT to_date(' 2009 03', '  MM') as extraspace; --returns > "0009-03-01" > SELECT to_date('2009 03', ' MM') as bogusspace; --returns "0009-03-01" > > Was it

Re: [BUGS] BUG #4862: different results in to_date() between 8.3.7 & 8.4.RC1

2009-06-22 Thread Tom Lane
Brendan Jurd writes: > Here's a one-line patch to fix a regression in the new from_char code > I introduced into 8.4. > Versions <= 8.3 skipped over any whitespace immediately preceding any > integer field, and this behaviour was lost in HEAD when my from_char > patch was committed back in Septem

Re: [BUGS] BUG #4862: different results in to_date() between 8.3.7 & 8.4.RC1

2009-06-22 Thread Brendan Jurd
2009/6/23 Tom Lane : > Brendan Jurd writes: >> I should be able to get the same results by snipping an extra >> strspace_len() characters in the new code path in >> from_char_parse_int_len().  This ought to be a one-line fix that >> doesn't clobber the good parts of my work so far.  I'll run some

Re: [BUGS] BUG #4862: different results in to_date() between 8.3.7 & 8.4.RC1

2009-06-22 Thread Tom Lane
Brendan Jurd writes: > I should be able to get the same results by snipping an extra > strspace_len() characters in the new code path in > from_char_parse_int_len(). This ought to be a one-line fix that > doesn't clobber the good parts of my work so far. I'll run some tests > and then post a pat

Re: [BUGS] BUG #4862: different results in to_date() between 8.3.7 & 8.4.RC1

2009-06-22 Thread Brendan Jurd
2009/6/23 Tom Lane : > I'm hesitant to fool with this post-RC, and we don't have "a couple of > days" to wait for a fix --- 8.4.0 is scheduled to wrap on Thursday. > However, I see that the first of these cases actually represents a > regression from 8.3 and before; existing releases get 2009-03-01

Re: [BUGS] BUG #4862: different results in to_date() between 8.3.7 & 8.4.RC1

2009-06-22 Thread Tom Lane
Brendan Jurd writes: > I think we can safely conclude from these results that Oracle pays no > attention whatsoever to leading spaces in either the input string, or > the format string. > If we want to copy this behaviour, I think the best way forward is to > add some code that deliberately skips

Re: [BUGS] BUG #4862: different results in to_date() between 8.3.7 & 8.4.RC1

2009-06-22 Thread Brendan Jurd
2009/6/22 Jeremy Ford : > Hi Brendan. > > Results as requested - Oracle 10g: Cheers for that Jeremy. I think we can safely conclude from these results that Oracle pays no attention whatsoever to leading spaces in either the input string, or the format string. If we want to copy this behaviour, I

Re: [BUGS] BUG #4862: different results in to_date() between 8.3.7 & 8.4.RC1

2009-06-22 Thread Jeremy Ford
Hi Brendan. Results as requested - Oracle 10g: SELECT TO_DATE(' 2009 03', 'MM') AS nospace FROM dual NOSPACE -- 1/03/2009 1 row selected SELECT TO_DATE(' 2009 03', ' MM') AS monthspace FROM dual MONTHSPACE -- 1/03/2009 1 row selected

Re: [BUGS] BUG #4862: different results in to_date() between 8.3.7 & 8.4.RC1

2009-06-22 Thread Brendan Jurd
2009/6/22 Jeremy Ford : > Oracle 9i: >  YEAR MONTH METHOD1 METHOD2 > >  2009 03   1/03/2009   1/03/2009 > > Oracle 10g: > YEAR  MONTH    METHOD1   METHOD2 > >  2009  03  1/03/2009    1/03/2009 > Hi Jeremy, The query you used above might not tell us

Re: [BUGS] BUG #4862: different results in to_date() between 8.3.7 & 8.4.RC1

2009-06-22 Thread Jeremy Ford
Oracle 9i: YEAR MONTH METHOD1 METHOD2 2009 03 1/03/2009 1/03/2009 Oracle 10g: YEAR MONTHMETHOD1 METHOD2 2009 03 1/03/20091/03/2009 Regards, Jeremy. On Sat, Jun 20, 2009 at 2:03 AM, Tom Lane wrote: > Brendan Jurd

Re: [BUGS] BUG #4862: different results in to_date() between 8.3.7 & 8.4.RC1

2009-06-19 Thread Tom Lane
Brendan Jurd writes: > I hope that answers your question. to_date() is by nature a weird > beast with many strange corners in its behaviour, and it's hard to > strike a balance between backwards compatibility and Least > Astonishment. My personal preference would be for a 100% strict > interpret

Re: [BUGS] BUG #4862: different results in to_date() between 8.3.7 & 8.4.RC1

2009-06-19 Thread Brendan Jurd
2009/6/19 Tom Lane : > regression=# select to_date(' 2009 07', ' MM'); >  to_date > >  2009-07-01 > (1 row) > > However, that just begs the question --- it seems that leading space is > allowed in MM, just not in .  Brendan, is that intentional or is it > a bug? > The reason t

Re: [BUGS] BUG #4862: different results in to_date() between 8.3.7 & 8.4.RC1

2009-06-19 Thread Tom Lane
"Jeremy Ford" writes: > select > to_char(2009,'') as year, > to_char(3,'09') as month, > to_date(to_char(2009,'')||to_char(3,'99') ,'MM') as method1, > to_date(to_char(2009,'')||'-'||to_char(3,'09') || '-01','-MM-DD') > as method2 Or, eliminating the extraneous st

[BUGS] BUG #4862: different results in to_date() between 8.3.7 & 8.4.RC1

2009-06-19 Thread Jeremy Ford
The following bug has been logged online: Bug reference: 4862 Logged by: Jeremy Ford Email address: jeremf...@gmail.com PostgreSQL version: 8.4 RC1 Operating system: Fedora 10 i386 Description:different results in to_date() between 8.3.7 & 8.4.RC1 Details: Running t