Re: [GENERAL] Result of timestamp - timestamp

Поиск
Список
Период
Сортировка
От Thomas Kellerer
Тема Re: [GENERAL] Result of timestamp - timestamp
Дата
Msg-id o7990o$4fd$1@blaine.gmane.org
обсуждение исходный текст
Ответ на Re: [GENERAL] Result of timestamp - timestamp  (Adrian Klaver <adrian.klaver@aklaver.com>)
Список pgsql-general
Adrian Klaver schrieb am 05.02.2017 um 22:40:
>> I just stumbled about a report that has been running for a long time now
>> and that relied on the fact that the interval "timestamp - timestamp"
>> always returns an interval with days, hours, minutes. But never a
>> "justified" interval with years, months, days and so on.
>
> According to the docs:
>
> https://www.postgresql.org/docs/9.6/static/functions-datetime.html
>
> "Subtraction of date or timestamp values with the "-" operator returns the number of days (24-hours) and
hours/minutes/secondsbetween the values, making the same adjustments." 
>
> It should always return days and hours.


Ah, great. For some reason I didn't find that.

>> The query usees "extract(day from timestamp - timestamp)" which is
>> working fine, but would apparently fail if a justified interval was
>> returned
>
> Did that happen?

No it didn't. I just was curious if I relied on something that might change.

Thanks

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

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: [GENERAL] Result of timestamp - timestamp
Следующее
От: Rui Pacheco
Дата:
Сообщение: [GENERAL] Logging broken messages