The following bug has been logged online:

Bug reference:      6231
Logged by:          Henk Enting
Email address:      h.d.ent...@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)

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Reply via email to