Re: Re: to_date problems (Re: Favor for Postgres User at WSI)

Поиск
Список
Период
Сортировка
От Karel Zak
Тема Re: Re: to_date problems (Re: Favor for Postgres User at WSI)
Дата
Msg-id Pine.LNX.3.96.1001109083342.20626J-100000@ara.zf.jcu.cz
обсуждение исходный текст
Ответ на Re: Re: to_date problems (Re: Favor for Postgres User at WSI)  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
On Wed, 8 Nov 2000, Tom Lane wrote:

> Karel Zak <zakkr@zf.jcu.cz> writes:
> >> I dunno whether there is any actual spec for to_date(), but I do agree
> >> that if you've specified a 2-digit YY format, something 2000-centric
> >> would be more useful than the current behavior.
> >>
> >> It doesn't seem to be doing anything particularly sensible with a
> >> 4-digit date, either:
> >>
> >> regression=# select to_date( '00001112', 'YYYYMMDD');
> >> to_date
> >> ------------
> >> 1112-11-12
> >> (1 row)
> >>
> >> This case I *would* have expected to produce 1 BC, but nope...
>
> >  Where is *guarantee* that the year is 4-digits?!
>
> Who said anything about a guarantee?  In the cases at hand, the number
> of Y's appearing in the format string should give you a sufficient clue
> about how to behave.  In fact, if I were you I'd reject a format string
> that had a number of Y's other than 2 or 4, because then it really isn't
> very clear what you're supposed to do.
>
> > And 'YY' - it's hell, what is '00'? ... 1900 or 2000 or 20000?
>
> It should work the same as the timestamp input converter.  Thomas
> Lockhart could give you more details about exactly what that code does.
> It's probably assuming that the intended value of a 2-digit year is
> between 1970 and 2069, or some other 100-year range that contains
> current time.
>
> Assuming that YY = '00' means 1 BC is definitely not reasonable
> behavior, at least not in the USA.  2-digit year notations are
> very common here, and no one uses them that way ;-)

 OK, OK... we gain me. Support something for this small country between
Canada and Mexico is probably pretty think. But else in the heaven I will
say that 'YY' is the hell...

 7.1 resolve it.
                        Karel

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

Предыдущее
От: Limin Liu
Дата:
Сообщение: unreachable block
Следующее
От: Sean Kelly
Дата:
Сообщение: Re: backend closed the channel unexpectedly?!?