Re: Sum(time) possible?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Sum(time) possible?
Дата
Msg-id 2528.1004811002@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Sum(time) possible?  (elwood@agouros.de (Konstantinos Agouros))
Список pgsql-general
elwood@agouros.de (Konstantinos Agouros) writes:
> I have a column of times that I would need to sum up for accounting purposes.
> Since sum(time) does not seem to be defined anybody got an easy clue how to
> do this?

We don't have addition of times defined at all, so how would you expect
sum() to exist?  Try casting the times to some datatype for which
addition makes sense, eg interval.

The reason time addition isn't defined is that it's not clear what
people would want.  Is '9:12 PM' + '4:23 AM' even sensible?  If
so, does it mean '1:35 AM' or '1 day 1 hour 35 minutes'?  Casting
to interval makes clear that you want the latter interpretation.

            regards, tom lane

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

Предыдущее
От: Kenneth Skiles
Дата:
Сообщение: trigger call shell script
Следующее
От: "Command Prompt, Inc."
Дата:
Сообщение: Re: Sum(time) possible?