Re: BUG #7797: datetime + '1 month'::interval is going outside of a month's bounds - Mailing list pgsql-bugs

From Tam Tran
Subject Re: BUG #7797: datetime + '1 month'::interval is going outside of a month's bounds
Date
Msg-id 50EB0BE4.4070705@gmail.com
Whole thread Raw
In response to Re: BUG #7797: datetime + '1 month'::interval is going outside of a month's bounds  (Ryan Kelly <rpkelly22@gmail.com>)
List pgsql-bugs
On 1/7/2013 9:47 AM, Ryan Kelly wrote:
> On Mon, Jan 01/07/13, 2013 at 05:42:40PM +0000, Daniele Varrazzo wrote:
>> On Mon, Jan 7, 2013 at 5:19 PM, Ryan Kelly <rpkelly22@gmail.com> wrote:
>>
>>> '1 month'::interval is the same as '30 days'::interval.
>> No, it's not.
>>
>> # select '2012-07-31'::date + '1 month'::interval, '2012-07-31'::date
>> + '30 days'::interval;
>>        ?column?       |      ?column?
>> ---------------------+---------------------
>>   2012-08-31 00:00:00 | 2012-08-30 00:00:00
>>
>> -- Daniele
> Alright, now I'm thoroughly confused. What magic makes this true:
>
> # select '30 days'::interval = '1 month'::interval;
>   ?column?
> ----------
>   t
>
> But not this:
>
> # select '2012-07-31'::timestamp + '1 month'::interval = '2012-07-31'::timestamp + '30 days'::interval;
>   ?column?
> ----------
>   f
>
> ?

interval type comparison and timestamp type comparison. It's not the
same comparison.

> -Ryan Kelly
>
>

Tam

pgsql-bugs by date:

Previous
From: Daniele Varrazzo
Date:
Subject: Re: BUG #7797: datetime + '1 month'::interval is going outside of a month's bounds
Next
From: Tom Lane
Date:
Subject: Re: BUG #7797: datetime + '1 month'::interval is going outside of a month's bounds