BUG #5031: DATE_TRUNC returns the wrong value when specifying MONTH

Поиск
Список
Период
Сортировка
От Mark Douglas
Тема BUG #5031: DATE_TRUNC returns the wrong value when specifying MONTH
Дата
Msg-id 200909022307.n82N7G6c075627@wwwmaster.postgresql.org
обсуждение исходный текст
Ответы Re: BUG #5031: DATE_TRUNC returns the wrong value when specifying MONTH  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
The following bug has been logged online:

Bug reference:      5031
Logged by:          Mark Douglas
Email address:      mark@steelhousemedia.com
PostgreSQL version: 8.4.0
Operating system:   Ubunto Linux
Description:        DATE_TRUNC returns the wrong value when specifying MONTH
Details:

The following use of DATE_TRUNC returns the wrong value. I called the
function on 2009-09-02. It should return '2009-09-01 00:00:00' for the
following usage:

SELECT DATE_TRUNC('MONTH', CURRENT_DATE);

It instead returns '2009-08-31 17:00:00.

Casting CURRENT_DATE to a TIMESTAMP causes it to return the correct value
but that shouldn't be required. Cast example:

SELECT DATE_TRUNC('MONTH', CAST(CURRENT_DATE AS TIMESTAMP));

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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: BUG #5028: CASE returns ELSE value always when type is"char"
Следующее
От: "Keith Cascio"
Дата:
Сообщение: BUG #5032: unexpected syntax error for plpgsql function returns table