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

Re: fixes for date_part micro/millisecond precision

From: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Brent Verner <brent(at)rcfile(dot)org>, pgsql-patches(at)postgresql(dot)org
Subject: Re: fixes for date_part micro/millisecond precision
Date: 2001-11-26 12:38:21
Message-ID: 20011126133821.E10818@zf.jcu.cz (view raw or flat)
Thread:
Lists: pgsql-patches
On Sat, Nov 24, 2001 at 02:24:09PM -0500, Tom Lane wrote:
> Brent Verner <brent(at)rcfile(dot)org> writes:
> >   This patch fixes a problem where extract/date_part returns bad values
> > for microsecond and millisecond parts.
> 
> I'm not convinced the existing behavior is wrong.  Timestamps are floats
> in PG, and therefore not infinitely precise.  Your patch seems to be
> trying to cover this up, but I fear it will only succeed in introducing
> other problems.

 Tom is right. If you need non-float microsecond/millisecond you can
 use to_char() -- it's news in 7.2:

test=# select to_char('2001-11-24 13:49:12.826833-05'::timestamp, 'MS');
 to_char
---------
   827

test=# select to_char('2001-11-24 13:49:12.826833-05'::timestamp, 'US');
 to_char
---------
 826833
     
        Karel
    
-- 
 Karel Zak  <zakkr(at)zf(dot)jcu(dot)cz>
 http://home.zf.jcu.cz/~zakkr/
 
 C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz

In response to

Responses

pgsql-patches by date

Next:From: Weiping HeDate: 2001-11-26 12:57:29
Subject: Re: Chinese NLS patch, the third try.
Previous:From: Tom LaneDate: 2001-11-26 03:52:38
Subject: Re: Added Encoding

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