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

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 (view raw or flat)
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

pgsql-novice by date

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

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