BUG #6231: weird to_timestamp behaviour with out of range values - Mailing list pgsql-bugs

From Henk Enting
Subject BUG #6231: weird to_timestamp behaviour with out of range values
Date
Msg-id 201109281455.p8SEtveU095497@wwwmaster.postgresql.org
Whole thread Raw
Responses Re: BUG #6231: weird to_timestamp behaviour with out of range values  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
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)

pgsql-bugs by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Problems with ENUM type manipulation in 9.1
Next
From: Tom Lane
Date:
Subject: Re: Problems with ENUM type manipulation in 9.1