Re: Fractions of seconds in timestamps

From: Chris Angelico <rosuav(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Fractions of seconds in timestamps
Date: 2012-04-24 14:59:12
Message-ID: CAPTjJmq3RZMs646Y3+yzNcOSPM7dN0EQQ5QfA2Y87-+n8vtOrg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Apr 25, 2012 at 12:51 AM, rihad <rihad(at)mail(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Willy-Bas Loos 2012-04-24 15:17:52 how robust are custom dumps?
Previous Message rihad 2012-04-24 14:51:48 Fractions of seconds in timestamps