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

Re: fixes for date_part micro/millisecond precision

From: Brent Verner <brent(at)rcfile(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: fixes for date_part micro/millisecond precision
Date: 2001-11-24 20:06:42
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-patches
On 24 Nov 2001 at 14:24 (-0500), Tom Lane wrote:
| Brent Verner <brent(at)rcfile(dot)org> writes:
| >   This patch fixes a problem where extract/date_part returns bad values
| > for microsecond and millisecond parts.
| I'm not convinced the existing behavior is wrong.  Timestamps are floats
| in PG, and therefore not infinitely precise.  Your patch seems to be
| trying to cover this up, but I fear it will only succeed in introducing
| other problems.

The current bahavior seems to be precise, just not accurate.

  I agree much that my fix is covering over the problem, but something 
needs to change (IMO), because if I insert a timestamp of
'2001-1-1 11:11:11.12341234-05' I /really/ want to get back '12341234'
when  I ask for the microseconds that I stored, so I can't see how the
current behavior isn't asking for problems in applications that use 
these features.  After many hours of looking at how to solve this, the
only way I could find to ensure "what I put in is what I get out," was
the change in timestamptz_part().

  Anyone have any idea of how (better) to fix this, short of
changing the internal representation of Timestamp to a struct? 
Is there a better place to 'force' the accuracy of the fractional
second part that would be less prone to introduce other problems?


"Develop your talent, man, and leave the world something. Records are 
really gifts from people. To think that an artist would love you enough
to share his music with anyone is a beautiful thing."  -- Duane Allman

In response to


pgsql-patches by date

Next:From: Tom LaneDate: 2001-11-24 20:32:27
Subject: Re: fixes for date_part micro/millisecond precision
Previous:From: Tom LaneDate: 2001-11-24 19:24:09
Subject: Re: fixes for date_part micro/millisecond precision

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