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

From: "Duncan Garland" <duncan(dot)garland(at)ntlworld(dot)com>
To: "Frank Bax" <fbax(at)sympatico(dot)ca>
Cc: <pgsql-novice(at)postgresql(dot)org>
Subject: Re: 8.2.1 to_char(negative interval,'HH24:MI') bug?
Date: 2007-01-29 11:09:47
Message-ID: MBEPKEEDMKGCDODFKLPPKEBGDMAA.duncan.garland@ntlworld.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Mine does that as well. In fact, it doesn't even give the right answer. I
don't know if it's been fixed in a later version.

Very odd.

Welcome to psql 7.4.13, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help on internal slash commands
\g or terminate with semicolon to execute query
\q to quit

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

-----Original Message-----
From: pgsql-novice-owner(at)postgresql(dot)org
[mailto:pgsql-novice-owner(at)postgresql(dot)org]On Behalf Of Frank Bax
Sent: 29 January 2007 02:31
To: pgsql-novice(at)postgresql(dot)org
Subject: [NOVICE] 8.2.1 to_char(negative interval,'HH24:MI') bug?

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)

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Saranya Sivakumar 2007-01-29 20:51:17 Thanks All!
Previous Message Peter Dawn 2007-01-29 06:12:53 Fill multiple fields through one INNER JOIN