pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Kirk Parker <khp@equatoria.us>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: him@nathanmlong.com <him@nathanmlong.com>
Cc: pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>
Subject: Re: Clarify: default precision on timestamps is 6
Date: Fri, 13 Oct 2023 16:37:53 -0400
Message-ID: <1571601.1697229473@sss.pgh.pa.us> (raw)
In-Reply-To: <CANwZ8r=5DFNcy70__Aeo58+rFysT1B=gEuzesoH5xpZ61tNFyA@mail.gmail.com>
References: <169719333062.169913.3076985245923767377@wrigleys.postgresql.org>
	<CAKFQuwb5hbSCy_zspr_MqqoE-k6MaGt47j1QBFNY-pn9Px8Zqw@mail.gmail.com>
	<CANwZ8r=5DFNcy70__Aeo58+rFysT1B=gEuzesoH5xpZ61tNFyA@mail.gmail.com>

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





view thread (5+ messages)

Message-ID: <1571601.1697229473@sss.pgh.pa.us>
Permalink:  ../1571601.1697229473@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1571601.1697229473@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, khp@equatoria.us, david.g.johnston@gmail.com, him@nathanmlong.com, pgsql-docs@lists.postgresql.org
  Subject: Re: Clarify: default precision on timestamps is 6
  In-Reply-To: <1571601.1697229473@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox