Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TsGIg-0008Je-Ac for pgsql-bugs@arkaria.postgresql.org; Mon, 07 Jan 2013 17:15:50 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1TsGIf-0006vL-2m for pgsql-bugs@arkaria.postgresql.org; Mon, 07 Jan 2013 17:15:49 +0000 Received: from magus.postgresql.org ([87.238.57.229]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TsDhy-0001si-SY for pgsql-bugs@postgresql.org; Mon, 07 Jan 2013 14:29:46 +0000 Received: from mahout.postgresql.org ([98.129.198.123]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TsDhw-0006mF-MG for pgsql-bugs@postgresql.org; Mon, 07 Jan 2013 14:29:46 +0000 Received: from [204.145.124.246] (helo=wrigleys.postgresql.org) by mahout.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TsDhv-00020a-S2 for pgsql-bugs@postgresql.org; Mon, 07 Jan 2013 14:29:43 +0000 Received: from www-data by wrigleys.postgresql.org with local (Exim 4.72) (envelope-from ) id 1TsDhv-00040y-0S for pgsql-bugs@postgresql.org; Mon, 07 Jan 2013 14:29:43 +0000 Date: Mon, 07 Jan 2013 14:29:43 +0000 Message-Id: Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #7797: datetime + '1 month'::interval is going outside of a month's bounds To: pgsql-bugs@postgresql.org From: afonit@gmail.com X-Pg-Spam-Score: -1.0 (-) 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 The following bug has been logged on the website: Bug reference: 7797 Logged by: Jared Thompson Email address: afonit@gmail.com PostgreSQL version: 9.2.2 Operating system: Ubuntu 12.04=20=20=20=20=20=20=20 Description:=20=20=20=20=20=20=20=20 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. 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 2012-01-28=20 and if we added one month to 2012-01-25 we do get 2012-02-25. It appears that the +'1 month'::interval is making it the next month and same date - but if there aren't the same number of days in the months it seems to be breaking as noted in the first example. Again, not sure what the expected behavior is but I would think that 'last day of a month' + '1 month'::interval would give 'last day of next month'. I realize on January 29-30th I am not sure what the expected behavior should be. --=20 Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs