Re: BUG #5227: please add a divide operator for intervals

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #5227: please add a divide operator for intervals
Дата
Msg-id 24948.1259797531@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #5227: please add a divide operator for intervals  ("Michal Pasternak" <michal.dtz@gmail.com>)
Ответы Re: BUG #5227: please add a divide operator for intervals  (Michał Pasternak <michal.dtz@gmail.com>)
Список pgsql-bugs
"Michal Pasternak" <michal.dtz@gmail.com> writes:
> Please add a divide operator for INTERVAL type, if possible.

Given that intervals have multiple subfields, it's far from obvious
what division should mean.  What is '1 month' / '1 day'?

> db=# SELECT EXTRACT(EPOCH FROM '15 seconds'::INTERVAL) / EXTRACT(EPOCH FROM
> '15 seconds'::INTERVAL);

If that's the behavior you want, you already have a way to do it
(and you could wrap that up in a user-defined operator if you chose).
It loses quite a lot of information though, so I doubt we'd want
to enshrine it as the standard definition.

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #5225: create table: cast necessary for constant??
Следующее
От: Michał Pasternak
Дата:
Сообщение: Re: BUG #5227: please add a divide operator for intervals