Re: BUG #18445: date_part / extract range for hours do not match documentation

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #18445: date_part / extract range for hours do not match documentation
Дата
Msg-id 3332891.1713883193@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #18445: date_part / extract range for hours do not match documentation  (PG Bug reporting form <noreply@postgresql.org>)
Ответы Re: BUG #18445: date_part / extract range for hours do not match documentation  (Marek Läll <lall.marek@gmail.com>)
Список pgsql-bugs
PG Bug reporting form <noreply@postgresql.org> writes:
> In https://www.postgresql.org/docs/8.1/functions-datetime.html

It would be a good idea to look at versions of the documentation
that aren't so many years obsolete.  8.1 has been EOL since 2010.

> We say that EXTRACT() should return a number between 0-23 for hours

What it says now is

        The hour field (0-23 in timestamps, unrestricted in intervals)

(This wording is currently only visible at
https://www.postgresql.org/docs/devel/functions-datetime.html#FUNCTIONS-DATETIME-EXTRACT
but it will propagate into the website's copies of still-maintained
branches at our next quarterly updates.)

> The function seems to also return 24 in some cases eg:
> SELECT date_part('hour', cast('24:00:00.00' as time))::int
> Could we update the documentation or modify the function so that it wraps 24
> back to 0 hours?

That edge case for type "time" is deliberate; see the definition
of that type in table 8.9 here:

https://www.postgresql.org/docs/devel/datatype-datetime.html

I don't really feel a need to clutter the documentation for EXTRACT()
still more by mentioning it there, especially since the current
wording is not wrong, just silent about that detail.

            regards, tom lane



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

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: BUG #15954: Unable to alter partitioned table to set logged
Следующее
От: Carl
Дата:
Сообщение: Error during installation on a 64 bit Windows 10 Korean environment using postgresql-15.6-1-windows-x64.exe