8.2.1 to_char(negative interval,'HH24:MI') bug?

From: Frank Bax <fbax(at)sympatico(dot)ca>
To: pgsql-novice(at)postgresql(dot)org
Subject: 8.2.1 to_char(negative interval,'HH24:MI') bug?
Date: 2007-01-29 02:30:46
Message-ID: 5.2.1.1.0.20070128205441.009fa600@pop6.sympatico.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

select age('2007-01-01 03:00','2007-01-01 04:59');
age
-----------
-01:59:00
(1 row)

select to_char(age('2007-01-01 03:00','2007-01-01 04:59'),'HH24:MI');
to_char
---------
-1:-59
(1 row)

Isn't just one '-' enough? This leads to a problem here:

select '2007-01-03 06:00'::timestamp + age('2007-01-01 03:00','2007-01-01
04:59');
?column?
---------------------
2007-01-03 04:01:00
(1 row)

select '2007-01-03 06:00'::timestamp + to_char(age('2007-01-01
03:00','2007-01-01 04:59'),'HH24:MI')::interval;
?column?
---------------------
2007-01-03 05:00:00
(1 row)

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Peter Dawn 2007-01-29 06:12:53 Fill multiple fields through one INNER JOIN
Previous Message Duncan Garland 2007-01-27 17:15:45 Re: Enable/Disable Trigger per single transaction