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

fixes for date_part micro/millisecond precision

From: Brent Verner <brent(at)rcfile(dot)org>
To: pgsql-patches(at)postgresql(dot)org
Subject: fixes for date_part micro/millisecond precision
Date: 2001-11-24 18:56:15
Message-ID: 20011124135615.A8009@rcfile.org (view raw or flat)
Thread:
Lists: pgsql-patches
Hi all,

  This patch fixes a problem where extract/date_part returns bad values
for microsecond and millisecond parts.  Patch is attached.  I'm not 
sure if the solution is correct, but it cures this symptom.

before:
========
brent=# select date_part('milliseconds','2001-11-24 13:49:12.826833-05'::timestamp);
    date_part     
------------------
 826.833000000001
(1 row)

brent=# select date_part('microseconds','2001-11-24 13:49:12.826833-05'::timestamp);
    date_part     
------------------
 826833.000000001
(1 row)


after:
========
brent=# select date_part('milliseconds','2001-11-24 13:49:12.826833-05'::timestamp);
 date_part 
-----------
   826.833
(1 row)

brent=# select date_part('microseconds','2001-11-24 13:49:12.826833-05'::timestamp);
 date_part 
-----------
    826833
(1 row)

cheers.
  brent

-- 
"Develop your talent, man, and leave the world something. Records are 
really gifts from people. To think that an artist would love you enough
to share his music with anyone is a beautiful thing."  -- Duane Allman

Responses

pgsql-patches by date

Next:From: Bruce MomjianDate: 2001-11-24 19:07:00
Subject: Re: Chinese NLS patch, the third try.
Previous:From: Tom LaneDate: 2001-11-24 17:47:10
Subject: Re: Support for QNX6, POSIX IPC and PTHREAD-style locking

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