Re: [GENERAL] Convert TimeStamp to Date

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dmitry Tkach <dmitry(at)openratings(dot)com>
Cc: Claudio Lapidus <clapidus(at)hotmail(dot)com>, pgsql-general(at)postgresql(dot)org, Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net>, shuai(at)objectwareinc(dot)com, pgsql-bugs(at)postgresql(dot)org
Subject: Re: [GENERAL] Convert TimeStamp to Date
Date: 2003-07-24 00:31:15
Message-ID: 13744.1059006675@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-general

Dmitry Tkach <dmitry(at)openratings(dot)com> writes:
> In 7.3 (and 7.4) timestamptz_date () is still doing that (and select
> '1999-12-31 00:00:01'::timestamptz::date still works),
> *but* timestamp_date() is changed for some reason to just divide the
> timestamp by the number of microseconds per day, that is obviously wrong
> for the case when ts is negative (before 2000) because integer division
> (unlike floor ()) truncates towards zero...

Good catch. It looks like Tom Lockhart changed this routine when he was
adding the int64-timestamp option. He probably had a momentary brain
fade about the direction of rounding needed :-(

I've changed it back to doing things the 7.2 way in CVS tip. This will
be in 7.3.4 unless Marc already wrapped the tarball, which I don't think
he did.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2003-07-24 02:29:21 Re: Small problem in contrib/dbase/dbf2pg.c
Previous Message Dmitry Tkach 2003-07-23 22:36:34 Re: Convert TimeStamp to Date

Browse pgsql-general by date

  From Date Subject
Next Message Jean-Christian Imbeault 2003-07-24 02:43:48 SAP DB: The unsung Open Source DB
Previous Message Karsten Hilbert 2003-07-24 00:00:33 Re: Role Models Wanted