From: Tom Lane <tgl@sss.pgh.pa.us>
To: afonit@gmail.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #7797: datetime + '1 month'::interval is going outside of a month's bounds
Date: Mon, 07 Jan 2013 12:58:40 -0500
Message-ID: <13279.1357581520@sss.pgh.pa.us> (raw)
In-Reply-To: <E1TsDhv-00040y-0S@wrigleys.postgresql.org>
References: <E1TsDhv-00040y-0S@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, afonit@gmail.com
Subject: Re: BUG #7797: datetime + '1 month'::interval is going outside of a month's bounds
In-Reply-To: <13279.1357581520@sss.pgh.pa.us>
References: <E1TsDhv-00040y-0S@wrigleys.postgresql.org> <13279.1357581520@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox