Re: fixes for date_part micro/millisecond precision

Поиск
Список
Период
Сортировка
От Karel Zak
Тема Re: fixes for date_part micro/millisecond precision
Дата
Msg-id 20011126133821.E10818@zf.jcu.cz
обсуждение исходный текст
Ответ на Re: fixes for date_part micro/millisecond precision  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: fixes for date_part micro/millisecond precision  (Brent Verner <brent@rcfile.org>)
Список pgsql-patches
On Sat, Nov 24, 2001 at 02:24:09PM -0500, Tom Lane wrote:
> Brent Verner <brent@rcfile.org> writes:
> >   This patch fixes a problem where extract/date_part returns bad values
> > for microsecond and millisecond parts.
>
> I'm not convinced the existing behavior is wrong.  Timestamps are floats
> in PG, and therefore not infinitely precise.  Your patch seems to be
> trying to cover this up, but I fear it will only succeed in introducing
> other problems.

 Tom is right. If you need non-float microsecond/millisecond you can
 use to_char() -- it's news in 7.2:

test=# select to_char('2001-11-24 13:49:12.826833-05'::timestamp, 'MS');
 to_char
---------
   827

test=# select to_char('2001-11-24 13:49:12.826833-05'::timestamp, 'US');
 to_char
---------
 826833

        Karel

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

 C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Added Encoding
Следующее
От: Weiping He
Дата:
Сообщение: Re: Chinese NLS patch, the third try.