Re: Dates BC.

Поиск
Список
Период
Сортировка
От Karel Zak
Тема Re: Dates BC.
Дата
Msg-id 20031219102203.GE24721@zf.jcu.cz
обсуждение исходный текст
Ответ на Re: Dates BC.  ("Dann Corbit" <DCorbit@connx.com>)
Ответы Re: Dates BC.  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-hackers
On Fri, Dec 19, 2003 at 01:12:08AM -0800, Dann Corbit wrote:
> There is no zero calendar year.  The first year of Anno Domini is 1.  It's ordinal, not cardinal.
I agree. But  the follow quoted  code is  not use in  date_part() thereKurt  found bug. It's  used  in to_timestamp()
_only_, and it  works,because tm2timestamp() and date2j() work with zero year.
 

> >  Is there connection between formatting.c and date_part() ? 
> >  I don't think so...
> > 
> > > In backend/utils/adt/formatting.c:
> > > 
> > >         if (tmfc.bc)
> > >         {
> > >                 if (tm->tm_year > 0)
> > >                         tm->tm_year = -(tm->tm_year - 1);                           
... "tm->tm_year = -(tm->tm_year - 1)" is used for:

# select to_timestamp('0001/01/01 BC', 'YYYY/MM/DD AD');    to_timestamp      
------------------------0001-01-01 00:00:00 BC      and it's OK.

I  think a  bug  is  somewhere in  timestamp2tm()  which  used in  nextexamples and it's shared between more
functions:

# select to_char('0001-01-01 BC'::date, 'YYYY/MM/DD AD');   to_char    ---------------0000/01/01 AD

# SELECT EXTRACT(YEAR from '0001-01-01 BC'::date);date_part -----------        0          
   Karel


-- Karel Zak  <zakkr@zf.jcu.cz>http://home.zf.jcu.cz/~zakkr/


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

Предыдущее
От: "Dann Corbit"
Дата:
Сообщение: Re: Dates BC.
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Linking with -lc not a good idea