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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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 Content-Type Size
bugs.patch text/x-diff 596 bytes

Responses

Browse pgsql-hackers by date

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