BUG #6231: weird to_timestamp behaviour with out of range values

From: "Henk Enting" <h(dot)d(dot)enting(at)mgrid(dot)net>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #6231: weird to_timestamp behaviour with out of range values
Date: 2011-09-28 14:55:57
Message-ID: 201109281455.p8SEtveU095497@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 6231
Logged by: Henk Enting
Email address: h(dot)d(dot)enting(at)mgrid(dot)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)

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2011-09-28 15:40:37 Re: Problems with ENUM type manipulation in 9.1
Previous Message Alvaro Herrera 2011-09-28 14:51:40 Re: Problems with ENUM type manipulation in 9.1