Skip site navigation (1) Skip section navigation (2)

Re: is this my date problem

From: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Theodore Petrosky <tedpet5(at)yahoo(dot)com>,pgsql-bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: is this my date problem
Date: 2003-10-02 07:32:26
Message-ID: 20031002073226.GF10129@zf.jcu.cz (view raw or flat)
Thread:
Lists: pgsql-bugs
On Wed, Oct 01, 2003 at 11:38:55PM -0400, Tom Lane wrote:
> Theodore Petrosky <tedpet5(at)yahoo(dot)com> writes:
> > I should have sent this... it is very interesting..
> > agencysacks=# select to_timestamp('01 October 2003
> > 00:01', 'DD Month YYYY HH24:MI');
> >     to_timestamp     
> > ---------------------
> >  0003-10-01 00:01:00
> > (1 row)
> 
> Oh ... duh ... you should have said
> 
> regression=# select to_timestamp('01 October 2003 00:01', 'DD FMMonth YYYY HH24:MI');
>       to_timestamp
> ------------------------
>  2003-10-01 00:01:00-04
> (1 row)
> 
> There's been repeated discussion about whether our to_timestamp code
> should be more forgiving of input that does not match the given format,
> but right at the moment it's pretty unforgiving.
> 
> BTW, have you considered the likelihood that you shouldn't be using
> to_timestamp at all?  The timestamp datatype input converter gets this
> right:
> 
> regression=# select '01 October 2003 00:01'::timestamp;
>       timestamp
> ---------------------
>  2003-10-01 00:01:00
> (1 row)
> 
> ISTM that to_timestamp is intended for cases where you want to be rigid
> about the data format.  If you think that the input data is
> self-explanatory then try just casting it to timestamp.

 The to_timestamp() do nothing with date/time and use internal 
 tm2timestamp() routine only. I don't think that check all date/time
 ranges in to_timestamp() is good idea if it's already implemented at
 the another place in our code.

    Karel


-- 
 Karel Zak  <zakkr(at)zf(dot)jcu(dot)cz>
 http://home.zf.jcu.cz/~zakkr/

In response to

Responses

pgsql-bugs by date

Next:From: Max KellermannDate: 2003-10-02 10:16:04
Subject: 7.3.4: memory leak in fe-exec.c:279 (realloc)
Previous:From: ArguileDate: 2003-10-02 05:02:46
Subject: Re: bug report: 7.4beta3 pg_ctl log handling

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group