Re: Output of date_part('quarter', date)

Поиск
Список
Период
Сортировка
От Thomas Lockhart
Тема Re: Output of date_part('quarter', date)
Дата
Msg-id 3A53500E.5A13219B@fourpalms.org
обсуждение исходный текст
Ответ на Output of date_part('quarter', date)  ("Denis V. Osadchy" <osadchy@turbo.nsk.su>)
Список pgsql-bugs
> I tried to use function date_part('quarter', date) in query and I have
> got wrong results...

Yeesh! Don't know what I was thinking at the time, but it sure is wrong.
If you have PostgreSQL built from source, then you can fix this by
editing src/backend/utils/timestamp.c on or around line 2056. Change a
single line, just under the "case DTK_QUARTER:" from

  result = (tm->tm_mon / 4) + 1;

to

  result = ((tm->tm_mon - 1) / 3) + 1;

and you should start getting the right answer. Will be fixed in the next
release.

                       - Thomas

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

Предыдущее
От: pgsql-bugs@postgresql.org
Дата:
Сообщение: impossible to create a table having the same name of a sequence object
Следующее
От: Tom Lane
Дата:
Сообщение: Re: impossible to create a table having the same name of a sequence object