Thread: to_char(interval, text) deprecated in future - how do we get consistent interval output without it?

to_char(interval, text) deprecated in future - how do we get consistent interval output without it?

From
SCassidy@overlandstorage.com
Date:
I saw the note in the docs that to_char(interval, text) is deprecated, and
will be removed.  I searched the archives and saw more mentions of this,
but no real explanation as to how it is planned for us to get consistent
output formatting when querying a column containing interval data.

For example, if you have data in an "interval" column, and just SELECT it
(without special formatting), you get things like:
 00:05:00
3 days
1 day 04:00:00
3 days 03:10:00

Currently, if I use something like:  to_char(t.estimated_time, 'DD
HH24:MI'),  I seem to get consistent results that my program can easily
deal with:

00 00:05
00 00:10
01 04:00
00 01:05
03 03:10

Can someone please explain if there is something else I should be using, or
what the plans actually are for handling this in future?  Should I just
store the value in seconds as an integer and handle everything myself?

Thanks,
Susan Cassidy




----------------------------------------------------------------------------------------------
See our award-winning line of tape and disk-based
backup & recovery solutions at http://www.overlandstorage.com
----------------------------------------------------------------------------------------------


On Fri, Jan 14, 2005 at 11:36:26 -0800,
  SCassidy@overlandstorage.com wrote:
> I saw the note in the docs that to_char(interval, text) is deprecated, and
> will be removed.  I searched the archives and saw more mentions of this,
> but no real explanation as to how it is planned for us to get consistent
> output formatting when querying a column containing interval data.

You can use EXTRACT.