Re: One more question about intervals

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: One more question about intervals
Дата
Msg-id 9236.1004906329@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: One more question about intervals  ("Command Prompt, Inc." <pgsql-general@commandprompt.com>)
Список pgsql-general
"Command Prompt, Inc." <pgsql-general@commandprompt.com> writes:
> Look into SQL92 extract() syntax, or PostgreSQL's date_part(). It's sort
> of a hack, but you could extract the days and multiply by 24, and then add
> the hours field, e.g.:
> Depending on how large your intervals got, you might have to start
> extracting week, month or year fields as well. Does anyone know a better,
> more general solution than this? Something like extract(CUMULATIVE_HOURS),
> or something? ;)

date_part('EPOCH', foo) gives the total number of seconds in an
interval.  Or you can write extract(epoch from foo) if you want
to pretend this is SQL92-compatible.  Unfortunately it didn't
occur to the SQL authors to provide such a function...

            regards, tom lane

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

Предыдущее
От: "Command Prompt, Inc."
Дата:
Сообщение: Re: One more question about intervals
Следующее
От: "Jeff Lu"
Дата:
Сообщение: Is there an internal timestamp on a table when it was created?