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

Поиск
Список
Период
Сортировка
От Brendan Jurd
Тема Re: BUG #4862: different results in to_date() between 8.3.7 & 8.4.RC1
Дата
Msg-id 37ed240d0906212339i4073945cufc4cd7473644975e@mail.gmail.com
обсуждение исходный текст
Ответ на Re: BUG #4862: different results in to_date() between 8.3.7 & 8.4.RC1  (Jeremy Ford <jeremford@gmail.com>)
Ответы Re: BUG #4862: different results in to_date() between 8.3.7 & 8.4.RC1  (Jeremy Ford <jeremford@gmail.com>)
Список pgsql-bugs
2009/6/22 Jeremy Ford <jeremford@gmail.com>:
> Oracle 9i:
> =A0YEAR MONTH METHOD1=A0=A0=A0=A0 METHOD2
>
> =A02009 03=A0=A0 1/03/2009=A0=A0 1/03/2009
>
> Oracle 10g:
> YEAR=A0=A0=A0=A0=A0 MONTH=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ME=
THOD1=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 METHOD2
>
> =A02009=A0=A0=A0=A0=A0 03=A0=A0=A0=A0=A0=A0=A0=A0=A0 1/03/2009=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0 1/03/2009
>

Hi Jeremy,

The query you used above might not tell us the whole story, because
you also have calls to to_char() in there (which is where those
leading spaces are coming from), and I have no idea whether Oracle's
to_char() also adds those leading spaces.

It would be very helpful if you'd test the following against Oracle
and let us know what you get back, just to totally rule out any
interference from to_char():

SELECT to_date(' 2009 03', 'YYYYMM') as nospace;
SELECT to_date(' 2009 03', 'YYYY MM') as monthspace;
SELECT to_date(' 2009 03', ' YYYY MM') as bothspaces;
SELECT to_date(' 2009 03', '  YYYY MM') as extraspace;
SELECT to_date('2009 03', ' YYYY MM') as bogusspace;

> On Sat, Jun 20, 2009 at 2:03 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> My feeling about it is that we usually try to match Oracle's behavior
>> for to_date/to_char, so the $64 question is whether Oracle allows a
>> leading space in these same cases. =A0Anyone have it handy to test?

If it turns out that Oracle does ignore leading spaces, we might want
to just add a special case in the input string scanner to skip over
any whitespace at the beginning of the string before we begin
processing in earnest.

Depending on the results from the test cases I posted above, we might
want to do something similar for the format string also.

Cheers,
BJ

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Jeremy Ford
Дата:
Сообщение: Re: BUG #4862: different results in to_date() between 8.3.7 & 8.4.RC1
Следующее
От: Dave Page
Дата:
Сообщение: Re: BUG #4785: Installation fails