Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-general by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group