Re: '1 year' = '360 days' ????

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: '1 year' = '360 days' ????
Дата
Msg-id 4333.1098581895@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: '1 year' = '360 days' ????  (Doug McNaught <doug@mcnaught.org>)
Ответы Re: '1 year' = '360 days' ????  (Bruno Wolff III <bruno@wolff.to>)
Re: '1 year' = '360 days' ????  (Guy Fraser <guy@incentre.net>)
Список pgsql-general
Doug McNaught <doug@mcnaught.org> writes:
> template1=# select '1 year'::interval = '360 days'::interval;
>  ?column?
> ----------
>  t
> (1 row)

Yeah, if you look at interval_cmp_internal() it's fairly obvious why.
I think that this definition is probably bogus, and that only intervals
that match exactly (equal months parts *and* equal seconds parts) should
be considered "equal".  However the most obvious way to redefine it
(compare the months, and only if equal compare the seconds) would lead
to rather nonintuitive behaviors such as "'1 year' > '1000 days'".
Anybody have any thoughts about a better way to map the multicomponent
reality into a one-dimensional sorting order?

(Note also that as Bruno was just mentioning, we really ought to have
months/days/seconds components, not just months/seconds; which makes the
comparison issue even more interesting.)

            regards, tom lane

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

Предыдущее
От: "Scott Marlowe"
Дата:
Сообщение: Re: how to port Oracle database to PostgreSQL?
Следующее
От: Bruno Wolff III
Дата:
Сообщение: Re: '1 year' = '360 days' ????