Re: Clarify: default precision on timestamps is 6 - Mailing list pgsql-docs

From Kirk Parker
Subject Re: Clarify: default precision on timestamps is 6
Date
Msg-id CANwZ8r=5DFNcy70__Aeo58+rFysT1B=gEuzesoH5xpZ61tNFyA@mail.gmail.com
Whole thread Raw
In response to Clarify: default precision on timestamps is 6  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: Clarify: default precision on timestamps is 6
List 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(1)::timestamp(6) with time zone;
          current_timestamp
      --------------------------
       2023-10-13 17:23:04.2+00
      (1 row)

pgsql-docs by date:

Previous
From: Nathan Long
Date:
Subject: Re: Clarify: default precision on timestamps is 6
Next
From: Daniel Fredouille
Date:
Subject: Re: unnest multirange, returned order