Re: Problem in converting int to timestamp value - why?

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Soeren Gerlach <soeren(at)all-about-shift(dot)com>, pgsql-general(at)postgresql(dot)org, Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
Subject: Re: Problem in converting int to timestamp value - why?
Date: 2004-09-19 22:09:22
Message-ID: 20040919220922.GA95715@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, Sep 19, 2004 at 12:31:26PM -0400, Tom Lane wrote:
> Michael Fuhr <mike(at)fuhr(dot)org> writes:
> > The leading space is confusing to_timestamp():
>
> > test=> SELECT to_timestamp(' 2004 12 17', 'YYYY MM DD');
> > to_timestamp
> > ---------------------
> > 2171-11-06 06:00:00
>
> I'd still say this is a bug. If to_timestamp can't match the input to
> the pattern, it should throw an error, not silently return garbage.

Agreed that it's a bug. Returning garbage violates the Principle
of Least Surprise.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message D. Stimits 2004-09-19 22:46:07 Re: import/export or moving data between databases
Previous Message Iavor Raytchev 2004-09-19 20:55:50 Re: import/export or moving data between databases