Re: [SQL] Interval subtracting

Поиск
Список
Период
Сортировка
От Jim C. Nasby
Тема Re: [SQL] Interval subtracting
Дата
Msg-id 20060301182428.GF82012@pervasive.com
обсуждение исходный текст
Ответ на Re: [SQL] Interval subtracting  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-hackers
On Wed, Mar 01, 2006 at 12:59:29PM -0500, Bruce Momjian wrote:
> Good question.  Should we restrict days to 0 - 30 or -30 - 30?  The
> current system does the later:
> 
>     test=> select justify_days('-45 days');
>        justify_days
>     ------------------
>      -1 mons -15 days
>     (1 row)
> 
>     test=> select justify_days('1 month -45 days');
>      justify_days
>     --------------
>      -15 days
>     (1 row)
> 
>     test=> select justify_days('1 month -15 days');
>       justify_days
>     ----------------
>      1 mon -15 days
>     (1 row)
> 
> Should we be adjusting the last one?  I am unsure.  Comments?

ISTM it should be looking at the sign of the overall interval, and
sticking with that consistently. So while '1 mon 5 days' and '-3 mon -8
days' both make sense, '1 mon -2 days' doesn't make nearly as much sense
in the general case. Of course this is complicated by the fact that '1
mon 20 days' doesn't necessarily equate to '2 mon -10 days'... :(

One of these days we should just create a new calendar. ;)
-- 
Jim C. Nasby, Sr. Engineering Consultant      jnasby@pervasive.com
Pervasive Software      http://pervasive.com    work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf       cell: 512-569-9461


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

Предыдущее
От: Mark Dilger
Дата:
Сообщение: Re: [SQL] Interval subtracting
Следующее
От: Peter Eisentraut
Дата:
Сообщение: PostgreSQL Anniversary Summit, Call for Contributions