Re: timestamp resolution?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: timestamp resolution?
Дата
Msg-id 29540.1002219209@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: timestamp resolution?  (Thomas Lockhart <lockhart@fourpalms.org>)
Список pgsql-hackers
Thomas Lockhart <lockhart@fourpalms.org> writes:
> I'm going through gram.y and fixing up the implementations of
> CURRENT_TIMESTAMP et al. One point folks will run into is that
> CURRENT_TIMESTAMP *should* return time to the second, not fractions
> thereof, and CURRENT_TIMESTAMP(p) should be used to get something more
> precise. Another issue I just noticed is that the result of

> create table t1 (d timestamp(2) default current_timestamp);

> gives me two decimal points of fractional seconds (after fixups for
> Tatsuo's reported troubles) but I would think that it should round to
> the second. Looks like we are "type folding" past the typmod attributes.

No, it's just that CURRENT_TIMESTAMP doesn't presently reduce its
precision, as you assert it should do.  However, I see nothing in SQL99
6.19 that asserts anything about the precision of CURRENT_TIMESTAMP
without a precision indicator.  It just says
        2) If specified, <time precision> and <timestamp precision>           respectively determine the precision of
thetime or timestamp           value returned.
 

which seems to leave it up to us to choose the behavior when no
precision is specified.  I'd prefer to see CURRENT_TIMESTAMP return as
much precision as possible (see also previous message).

BTW, CURRENT_TIME and CURRENT_TIMESTAMP should return TIMETZ and
TIMESTAMPTZ respectively, but currently do not --- are you fixing that?
        regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Beta time
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: Beta time