Re: Absolute value of intervals
От | Sam Mason |
---|---|
Тема | Re: Absolute value of intervals |
Дата | |
Msg-id | 20091102130036.GG5407@samason.me.uk обсуждение исходный текст |
Ответ на | Re: Absolute value of intervals (Jasen Betts <jasen@xnet.co.nz>) |
Ответы |
Re: Absolute value of intervals
|
Список | pgsql-general |
On Mon, Nov 02, 2009 at 10:52:40AM +0000, Jasen Betts wrote: > what's the absolute value of '1month -30 days'::interval > > if I add it to the first of march it goes forwards if I add it to the > first of february if goes backwards. if I add it to the first of april > it goes nowhere. > > select '2008-02-01'::date + '1month -30days'::interval; > select '2008-03-01'::date + '1month -30days'::interval; > select '2008-04-01'::date + '1month -30days'::interval; > > I'm guessing that '1 month 30 days' is the only mathematically > consistent answer, not that it's likely to be useful. Except that this is not consistent with itself. Most definitions have the absolute value of a number being the same as either the number itself or its negation. -- Sam http://samason.me.uk/
В списке pgsql-general по дате отправления: