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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Attachment Content-Type Size
timestamp.diff text/plain 1.3 KB

Responses

Browse pgsql-patches by date

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