Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TsGyB-0000Zh-Pp for pgsql-bugs@arkaria.postgresql.org; Mon, 07 Jan 2013 17:58:43 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1TsGyA-0005XT-QE for pgsql-bugs@arkaria.postgresql.org; Mon, 07 Jan 2013 17:58:42 +0000 Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TsGyA-0005XO-7Z for pgsql-bugs@postgresql.org; Mon, 07 Jan 2013 17:58:42 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TsGy9-00072q-Aa for pgsql-bugs@postgresql.org; Mon, 07 Jan 2013 17:58:41 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id r07HwexO013280; Mon, 7 Jan 2013 12:58:40 -0500 (EST) From: Tom Lane 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 In-reply-to: References: Comments: In-reply-to afonit@gmail.com message dated "Mon, 07 Jan 2013 14:29:43 +0000" Date: Mon, 07 Jan 2013 12:58:40 -0500 Message-ID: <13279.1357581520@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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