Re: Clarify: default precision on timestamps is 6
От | Kirk Parker |
---|---|
Тема | Re: Clarify: default precision on timestamps is 6 |
Дата | |
Msg-id | CANwZ8r=5DFNcy70__Aeo58+rFysT1B=gEuzesoH5xpZ61tNFyA@mail.gmail.com обсуждение исходный текст |
Ответ на | Clarify: default precision on timestamps is 6 ("David G. Johnston" <david.g.johnston@gmail.com>) |
Ответы |
Re: Clarify: default precision on timestamps is 6
|
Список | pgsql-docs |
On Fri, Oct 13, 2023 at 7:32 AM David G. Johnston <david.g.johnston@gmail.com> wrote:
On Friday, October 13, 2023, PG Doc comments form <noreply@postgresql.org> wrote:both of them round any precision
beyond microseconds, and neither returns timestamps with greater precision
than the value that was inserted.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.David J.
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:
some_system=# select CURRENT_TIMESTAMP(0)::timestamp(6) with time zone;
current_timestamp
------------------------
2023-10-13 17:19:00+00
(1 row)
some_system=# select CURRENT_TIMESTAMP(0)::timestamp(6) with time zone;
current_timestamp
------------------------
2023-10-13 17:19:00+00
(1 row)
some_system=# select CURRENT_TIMESTAMP(1)::timestamp(6) with time zone;
current_timestamp--------------------------
2023-10-13 17:23:04.2+00
(1 row)
В списке pgsql-docs по дате отправления: