Re: Fractions of seconds in timestamps

From: rihad <rihad(at)mail(dot)ru>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Fractions of seconds in timestamps
Date: 2012-04-24 15:21:18
Message-ID: 4F96C4EE.5060707@mail.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 04/24/2012 07:51 PM, rihad wrote:
> As PostgreSQL stores timestamps with a fractional part, does it mean that
> WHERE f BETWEEN '2012-04-23 00:00:00' AND '2012'04-23 23:59:59' might
> miss
> records with values of f equal to 23:59:59.1234 or so?
>

Answering to myself: depends on how timestamp was defined at table
creation time

time, timestamp, and interval accept an optional precision value p which
specifies the number of fractional digits retained in the seconds field.
By default, there is no explicit bound on precision. The allowed range
of p is from 0 to 6 for the timestamp and interval types..

As the columns in question were explicitly created as timestamp(0) in
the database, they store no fractional part, so no matter at which
moment during the 59-th second the column is updated, it's always
exactly 59-th.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Emi Lu 2012-04-24 15:21:41 Re: Simple way to get missing number
Previous Message Willy-Bas Loos 2012-04-24 15:17:52 how robust are custom dumps?