pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Henk Enting <h.d.enting@mgrid.net>
To: pgsql-bugs@postgresql.org
Subject: BUG #6231: weird to_timestamp behaviour with out of range values
Date: Wed, 28 Sep 2011 14:55:57 GMT
Message-ID: <201109281455.p8SEtveU095497@wwwmaster.postgresql.org> (raw)


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)



view thread (5+ messages)  latest in thread

Message-ID: <201109281455.p8SEtveU095497@wwwmaster.postgresql.org>
Permalink:  ../201109281455.p8SEtveU095497@wwwmaster.postgresql.org/
Also on:    postgresql.org/message-id/201109281455.p8SEtveU095497@wwwmaster.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: h.d.enting@mgrid.net
  Subject: Re: BUG #6231: weird to_timestamp behaviour with out of range values
  In-Reply-To: <201109281455.p8SEtveU095497@wwwmaster.postgresql.org>
  References: <201109281455.p8SEtveU095497@wwwmaster.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox