Re: Bug in to_timestamp().

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: amul sul <sul_amul(at)yahoo(dot)co(dot)in>
Cc: Alex Ignatov <a(dot)ignatov(at)postgrespro(dot)ru>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Bug in to_timestamp().
Date: 2016-06-23 13:30:01
Message-ID: 20160623133001.GF21246@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jun 23, 2016 at 07:41:26AM +0000, amul sul wrote:
> On Monday, 20 June 2016 8:53 PM, Alex Ignatov <a(dot)ignatov(at)postgrespro(dot)ru> wrote:
>
>
> >>On 13.06.2016 18:52, amul sul wrote:
> >And it wont stop on some simple whitespace. By using to_timestamp you
> >can get any output results by providing illegal input parameters values:
>
> >postgres=# SELECT TO_TIMESTAMP('2016-06-13 99:99:99', 'YYYYMMDD
> >HH24:MI:SS');
> > to_timestamp
> >------------------------
> > 2016-01-06 14:40:39+03
> >
> > (1 row)
>
> We do consume extra space from input string, but not if it is in format string, see below:
>
> postgres=# SELECT TO_TIMESTAMP('2016-06-13 15:43:36', 'YYYY/MM/DD HH24:MI:SS');
> to_timestamp
> ------------------------
> 2016-06-13 15:43:36-07
> (1 row)
>
> We should have same treatment for format string too.
>
> Thoughts? Comments?

Well, the user specifies the format string, while the input string comes
from the data, so I don't see having them behave the same as necessary.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-06-23 13:59:34 Re: PQconnectdbParams vs PQconninfoParse
Previous Message Bruce Momjian 2016-06-23 13:26:45 Re: Question and suggestion about application binary compatibility policy