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

Interval output bug in HAVE_INT64_TIMESTAMP

From: Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Interval output bug in HAVE_INT64_TIMESTAMP
Date: 2008-10-02 09:53:34
Message-ID: 48E49A1E.8080309@cheapcomplexdevices.com (view raw or flat)
Thread:
Lists: pgsql-hackers
Seems to me there's a bug in HEAD (and probably old branches
as well) when compiled with HAVE_INT64_TIMESTAMP.  As shown below
It sometimes shows things like "-6.-70 secs" where 8.3
showed "-6.70 secs".

I think the attached one-liner patch fixes this, as well as
another roundoff regression between HEAD and 8.3.

   Ron Mayer

================================================================================
== ON HEAD
================================================================================
regression=#  set datestyle to sql;
SET
regression=#  select '-10 mons -3 days +03:55:06.70'::interval;
                       interval
----------------------------------------------------
  @ 10 mons 3 days -3 hours -55 mins -6.-70 secs ago
(1 row)

regression=# select '1 year 2 mons 3 days 04:05:06.699999'::interval;
                     interval
-------------------------------------------------
  @ 1 year 2 mons 3 days 4 hours 5 mins 6.69 secs
(1 row)

================================================================================
== ON 8.3
================================================================================
pg83=#  set datestyle to sql;
SET
pg83=# select '-10 mons -3 days +03:55:06.70'::interval;
                      interval
---------------------------------------------------
  @ 10 mons 3 days -3 hours -55 mins -6.70 secs ago
(1 row)


pg83=#  select '1 year 2 mons 3 days 04:05:06.699999'::interval;
                     interval
-------------------------------------------------
  @ 1 year 2 mons 3 days 4 hours 5 mins 6.70 secs
(1 row)

Attachment: bugs.patch
Description: text/x-diff (596 bytes)

Responses

pgsql-hackers by date

Next:From: Ron MayerDate: 2008-10-02 10:01:00
Subject: Re: Patch for SQL-Standard Interval output and decoupling DateStyle from IntervalStyle
Previous:From: Richard HuxtonDate: 2008-10-02 09:53:17
Subject: Re: Transactions within a function body

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