Re: Interval subtracting

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: Interval subtracting
Дата
Msg-id 20060218110129.W9818@megazone.bigpanda.com
обсуждение исходный текст
Ответ на Re: Interval subtracting  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Interval subtracting  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-sql
On Sat, 18 Feb 2006, Tom Lane wrote:

> "Milen A. Radev" <milen@radev.net> writes:
> > Milorad Poluga написа:
> >>> SELECT '10 years 1 mons 1 days'::interval - '9 years 10 mons 15 days'::interval
> >>> ?column?
> >>> ---------------
> >>> 3 mons -14 days
> >>>
> >>> Why not '2 mons  16 days' ?
>
> > Please read the last paragraph in section 8.5.1.4 of the manual
> > (http://www.postgresql.org/docs/8.1/static/datatype-datetime.html#AEN4775)
> > . It mentions the functions named "justify_days" and "justify_hours"
> > that could do what you need.
>
> justify_days doesn't currently do anything with this result --- it
> thinks its charter is only to reduce day components that are >= 30 days.
> However, I think a good case could be made that it should normalize
> negative days too; that is, the invariant on its result should be
> 0 <= days < 30, not merely days < 30.

What about cases like interval '1 month -99 days', should that turn into
interval '-3 mons +21 days' or '-2 mons -9 days'?


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Interval subtracting
Следующее
От: Janning Vygen
Дата:
Сообщение: Re: Need help: Find dirty rows, Update, Delete SQL