fixes for date_part micro/millisecond precision - Mailing list pgsql-patches

From Brent Verner
Subject fixes for date_part micro/millisecond precision
Date
Msg-id 20011124135615.A8009@rcfile.org
Whole thread Raw
Responses Re: fixes for date_part micro/millisecond precision
List 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

Attachment

pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: Support for QNX6, POSIX IPC and PTHREAD-style locking
Next
From: Bruce Momjian
Date:
Subject: Re: Chinese NLS patch, the third try.