Re: BUG #7797: datetime + '1 month'::interval is going outside of a month's bounds

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #7797: datetime + '1 month'::interval is going outside of a month's bounds
Дата
Msg-id 13279.1357581520@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #7797: datetime + '1 month'::interval is going outside of a month's bounds  (afonit@gmail.com)
Список pgsql-bugs
afonit@gmail.com writes:
> This query:
> select
> '2012-01-31'::date + '1 month'::interval

> Produces this result:
> "2012-02-29 00:00:00"

> 2012-02-29 is not a valid date.  February only goes to 28 days.

Uh, 2012 was a leap year, and so 2012-02-29 is a perfectly valid date.

> I am not sure what the expected behavior should be, but what I was expecting
> is (in the above instance):
> Adding one month to 2012-01-31 would yield the last day of February

It did.

            regards, tom lane

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

Предыдущее
От: Tam Tran
Дата:
Сообщение: Re: BUG #7797: datetime + '1 month'::interval is going outside of a month's bounds
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #7797: datetime + '1 month'::interval is going outside of a month's bounds