Re: Fractions of seconds in timestamps - Mailing list pgsql-general

From Chris Angelico
Subject Re: Fractions of seconds in timestamps
Date
Msg-id CAPTjJmq3RZMs646Y3+yzNcOSPM7dN0EQQ5QfA2Y87-+n8vtOrg@mail.gmail.com
Whole thread Raw
In response to Fractions of seconds in timestamps  (rihad <rihad@mail.ru>)
List pgsql-general
On Wed, Apr 25, 2012 at 12:51 AM, rihad <rihad@mail.ru> 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?

I think so. I would recommend either using inclusive-exclusive ranges
(eg WHERE f >= '2012-04-23' AND f < '2012-04-24'), or casting to date
(eg WHERE date(f)='2012-04-23').

(Untested code, might have syntax wrong a bit)

ChrisA

pgsql-general by date:

Previous
From: rihad
Date:
Subject: Fractions of seconds in timestamps
Next
From: Willy-Bas Loos
Date:
Subject: how robust are custom dumps?