Re: [SQL] Interval subtracting

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: [SQL] Interval subtracting
Дата
Msg-id 200603012302.k21N2Hm04879@candle.pha.pa.us
обсуждение исходный текст
Ответ на Re: [SQL] Interval subtracting  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: [SQL] Interval subtracting  (Mark Dilger <pgsql@markdilger.com>)
Re: [SQL] Interval subtracting  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > Imagine this:
> 
> >     '1 mons -2 days -12:00:00'
> 
> > Which sign do we head to for this?  For justify_hours, if we don't look
> > at the months it remains unchange, but calling justify_days we get:
> 
> >     '28 days -12:00:00'
> 
> > which is wrong (negative and positive).
> 
> Ugh, that's not good.
> 
> Based on that, I guess I have to change my vote: justify_hours should
> still not look at the month (because it shouldn't use the month=30days
> assumption), but justify_days should be changed to be effectively a
> combination of both functions --- that is, it should fix all three
> fields using both the 30days and the 24hours assumptions.  Then it could
> guarantee that all come out with the same sign.

If we do that, we should just call it justify_interval().  I am thinking
this is the direction to go, and for people who want more control they
use the justify_hours and justify_days, and those are left unchanged.

Should justify_days() look at hours only if the day and hours signs
differ?  And perhaps only if the hours is between -24 and 0.

--  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 по дате отправления:

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