Re: Clarify: default precision on timestamps is 6

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Clarify: default precision on timestamps is 6
Дата
Msg-id 1571601.1697229473@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Clarify: default precision on timestamps is 6  (Kirk Parker <khp@equatoria.us>)
Список pgsql-docs
Kirk Parker <khp@equatoria.us> writes:
> On Fri, Oct 13, 2023 at 7:32 AM David G. Johnston <
> david.g.johnston@gmail.com> wrote:
>> That is precisely what a no default with maximum of six means.  If we say
>> the default is six that would imply storage of less precise values pads
>> significant zeros until there are six.

> Not sure that last statement is correct.  In 13 (only system I have access
> to at the moment) it doesn't look like casting to a precision greater than
> the value originally had causes any padding:

The timestamp types don't have any explicit notion of precision
(unlike, say, numeric).  The stored value is an integer number of
microseconds, nothing else.  I've not checked the output function
recently but it makes sense to me that it'd just drop trailing
zeroes from the display, independently of any claimed precision
for the column.  Meanwhile, when casting a timestamp value to
a declared precision, we handle that by just rounding off the
microseconds count.  This doesn't buy any space savings or anything
like that, it's just for pro-forma compliance with the spec.

I don't see anything particularly wrong with the existing docs.
The limitation to 1-microsecond precision is spelled out in the
table just above the para you quote.

            regards, tom lane



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

Предыдущее
От: Daniel Fredouille
Дата:
Сообщение: Re: unnest multirange, returned order
Следующее
От: Tomas Pospisek
Дата:
Сообщение: Re: Make SSPI documentation clearer