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

From Tom Lane
Subject Re: BUG #7797: datetime + '1 month'::interval is going outside of a month's bounds
Date
Msg-id 13442.1357582015@sss.pgh.pa.us
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
Ryan Kelly <rpkelly22@gmail.com> writes:
> 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.

> Alright, now I'm thoroughly confused. What magic makes this true:
> # select '30 days'::interval = '1 month'::interval;
>  ?column?
> ----------
>  t

'1 month' and '30 days' are distinct concepts.  Some operations will
treat them as equal, if there is no additional info that will nail
down the actual length of the particular month in question.  Or if
you like, 30 days is the "default" length of a month.

A related point is that the interval equality operator will say that
'24 hours' and '1 day' are equal, even though they aren't the same
thing --- there are cases where they behave differently, when working
near a DST transition time.

There might be some use for an interval "identity" operator, which would
only say true for completely-indistinguishable interval values; but we
don't have one.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #7797: datetime + '1 month'::interval is going outside of a month's bounds
Next
From: Rodrigo Rosenfeld Rosas
Date:
Subject: wrong search_path being used