Re: [SQL] Interval subtracting

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: [SQL] Interval subtracting
Дата
Msg-id 200603012326.k21NQOv08610@candle.pha.pa.us
обсуждение исходный текст
Ответ на Re: [SQL] Interval subtracting  (Mark Dilger <pgsql@markdilger.com>)
Ответы Re: [SQL] Interval subtracting  (Mark Dilger <pgsql@markdilger.com>)
Список pgsql-hackers
Mark Dilger wrote:
> Tom Lane wrote:
> > Well, the question is whether justify_days has a sane definition that is
> > different from this.  Based on your example, I'm not seeing one.
> 
> Backwards compatibility is probably more important than sanity.  Let's just 
> deprecate the existing functions and recommend that people use 
> justify_interval(...).  By not changing the existing functions we can avoid a 
> certain amount of hell.

Those functions are new in 8.1 so I do think we can improve them in 8.2
if we agree.  Tom's idea of:

>       * month > 0 and 0 <= day < 30
>       * month < 0 and -30 < day <= 0
>       * month = 0 and -30 < day < 30

seems a good change for 8.2, and the same for justify_hours(). The
question is whether justify_days should also adjust hours I think is the
issue, and the reason for a justify_interval() function.  Even if we had
people do:
justify_hours(justify_days(justify_hours()))

I don't think that would do what we want in all cases.  Consider '1 mon
-1 hour'.  That should be '29 days 23 hours' but neither existing
function, even if modified, will allow us to return that.  Only
something like justify_interval() could do it.

--  Bruce Momjian   http://candle.pha.pa.us SRA OSS, Inc.   http://www.sraoss.com
 + If your life is a hard drive, Christ can be your backup. +


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [SQL] Interval subtracting
Следующее
От: Mark Dilger
Дата:
Сообщение: Re: [SQL] Interval subtracting