Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 92ECCB5DBDB for ; Wed, 28 Sep 2011 11:55:58 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 58888-08 for ; Wed, 28 Sep 2011 14:55:58 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by mail.postgresql.org (Postfix) with ESMTP id 01EE8B5DBC4 for ; Wed, 28 Sep 2011 11:55:57 -0300 (ADT) Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by wwwmaster.postgresql.org (8.14.3/8.14.3) with ESMTP id p8SEtvon095498 for ; Wed, 28 Sep 2011 14:55:57 GMT (envelope-from www@wwwmaster.postgresql.org) Received: (from www@localhost) by wwwmaster.postgresql.org (8.14.3/8.14.3/Submit) id p8SEtveU095497; Wed, 28 Sep 2011 14:55:57 GMT (envelope-from www) Date: Wed, 28 Sep 2011 14:55:57 GMT Message-Id: <201109281455.p8SEtveU095497@wwwmaster.postgresql.org> To: pgsql-bugs@postgresql.org Subject: BUG #6231: weird to_timestamp behaviour with out of range values From: "Henk Enting" Content-Type: text/plain; charset=utf-8 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 201109/214 X-Sequence-Number: 31231 The following bug has been logged online: Bug reference: 6231 Logged by: Henk Enting Email address: h.d.enting@mgrid.net PostgreSQL version: 9.1.1 Operating system: linux x86_64 Description: weird to_timestamp behaviour with out of range values Details: I would expect the to_timestamp function to return an error when I feed it out of range values, e.g. months > 13 and days > 31. Instead it seems to add the surplus to the timestamp and then return it. E.g. 21-21 becomes sept. 22th the next year. psql output: postgres=# select to_timestamp('2011-21-21', 'YYYY-MM-DD'); to_timestamp ------------------------ 2012-09-22 00:00:00+02 (1 row) postgres=# select to_timestamp('2011-21-42', 'YYYY-MM-DD'); to_timestamp ------------------------ 2012-10-13 00:00:00+02 (1 row)