Re: [HACKERS] timestamp subtraction (was Re: formatting intervals with to_char)

Поиск
Список
Период
Сортировка
От Jim Nasby
Тема Re: [HACKERS] timestamp subtraction (was Re: formatting intervals with to_char)
Дата
Msg-id DB91DDA2-F0F2-42CF-B5E8-A481E622F1CD@enterprisedb.com
обсуждение исходный текст
Ответ на timestamp subtraction (was Re: formatting intervals with to_char)  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: [HACKERS] timestamp subtraction (was Re: formatting intervals with to_char)  ("Aaron Bono" <postgresql@aranya.com>)
Re: [HACKERS] timestamp subtraction (was Re: formatting intervals with to_char)  (Bruce Momjian <bruce@momjian.us>)
Список pgsql-sql
On Oct 5, 2006, at 11:50 AM, Tom Lane wrote:
> regression=# select ('2006-09-15 23:59:00'::timestamp - '2006-09-01  
> 09:30:41'::timestamp);
>      ?column?
> ------------------
>  14 days 14:28:19
> (1 row)
>
> should be reporting '350:28:19' instead.
>
> This is a hack that was done to minimize the changes in the regression
> test expected outputs when we changed type interval from months/ 
> seconds
> to months/days/seconds.  But I wonder whether it wasn't a dumb idea.
> It is certainly inconsistent, as noted in the code comments.
>
> I'm tempted to propose that we remove the justify_hours call, and tell
> anyone who really wants the old results to apply justify_hours() to  
> the
> subtraction result for themselves.  Not sure what the fallout would  
> be,
> though.

I suspect there's applications out there that are relying on that  
being nicely formated for display purposes.

I agree it should be removed, but we might need a form of backwards  
compatibility for a version or two...
--
Jim Nasby                                    jimn@enterprisedb.com
EnterpriseDB      http://enterprisedb.com      512.569.9461 (cell)




В списке pgsql-sql по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] timestamp subtraction (was Re: formatting intervals with to_char)
Следующее
От: Jean-Paul Argudo
Дата:
Сообщение: Re: age() vs. timestamp substraction