Re: [BUGS] BUG #1927: incorrect timestamp returned

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: postgres(at)saparev(dot)com, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [BUGS] BUG #1927: incorrect timestamp returned
Date: 2005-10-08 02:46:44
Message-ID: 200510080246.j982kit00106@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-patches

Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > I have gone through the code and identified all the places that need
> > JROUND, basically places where we do complex calculations that include
> > fsec (fractional seconds). This only affects timestamp=double backends,
> > not timestamp=int64.
>
> I'm not sure I like this approach. What you've essentially done is to
> remove any possibility of getting more than six digits of fractional
> precision out of a "double" timestamp --- and impose nontrivial
> calculation overhead to make sure that double doesn't have any extra
> precision.
>
> I think it'd probably be better to just fix the rounding during display.

If we do that, should we remove some the existing JROUND calls in the
code? I think we have to do this consistently, at least.

Looking at the code, it seems JROUND() is used only in a few places:

dt2time
tm2interval
time2t
dt2local

What is the pattern on when to use it?

Also, I don't see how rounding is going to fix the problem that the
value is actually _rounded_ at different stages, meaning when you are
doing the output you don't know what came in, as outlined by my
timestamp_in data.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2005-10-08 02:59:33 Re: [BUGS] BUG #1927: incorrect timestamp returned
Previous Message Tom Lane 2005-10-07 21:49:46 Re: [BUGS] BUG #1927: incorrect timestamp returned

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2005-10-08 02:59:33 Re: [BUGS] BUG #1927: incorrect timestamp returned
Previous Message Tom Lane 2005-10-07 21:49:46 Re: [BUGS] BUG #1927: incorrect timestamp returned