From: amul sul <sul_amul@yahoo.co.in>
To: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Bug in to_timestamp().
Date: Mon, 13 Jun 2016 15:52:25 +0000 (UTC)
Message-ID: <1873520224.1784572.1465833145330.JavaMail.yahoo@mail.yahoo.com> (raw)
References: <1873520224.1784572.1465833145330.JavaMail.yahoo.ref@mail.yahoo.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
Hi,
It's look like bug in to_timestamp() function when format string has more whitespaces compare to input string, see below:
Ex.1: Two white spaces before HH24 whereas one before input time string
postgres=# SELECT TO_TIMESTAMP('2016-06-13 15:43:36', 'YYYY/MM/DD HH24:MI:SS');
to_timestamp
------------------------
2016-06-13 05:43:36-07 <— incorrect time
(1 row)
Ex.2: One whitespace before YYYY format string
postgres=# SELECT TO_TIMESTAMP('2016/06/13 15:43:36', ' YYYY/MM/DD HH24:MI:SS');
to_timestamp
------------------------------
0016-06-13 15:43:36-07:52:58 <— incorrect year
(1 row)
If there are one or more consecutive whitespace in the format, we should skip those as long as we could get an actual field.
Thoughts?
Thanks & Regards,
Amul Sul
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
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 using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: sul_amul@yahoo.co.in
Subject: Re: Bug in to_timestamp().
In-Reply-To: <1873520224.1784572.1465833145330.JavaMail.yahoo@mail.yahoo.com>
* 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