BUG #3761: Problems with to_char(timestamp) and milliseconds

Started by Jose Tomas Eterovicover 18 years ago2 messagesbugs
Jump to latest
#1Jose Tomas Eterovic
roleroz@gmail.com

The following bug has been logged online:

Bug reference: 3761
Logged by: Jose Tomas Eterovic
Email address: roleroz@gmail.com
PostgreSQL version: 8.2.4-r1
Operating system: Gentoo Linux
Description: Problems with to_char(timestamp) and milliseconds
Details:

When you use to_char to show as a string a date (including milliseconds),
there's the possibility that the number of milliseconds will be 1000 (not
between 000-999 as the documentation says)

if you have a table (called "testTable") with a single column of type
"timestamp" (called "testTimestamp") with lots of data, and you run the
query

SELECT to_char(testTimestamp, 'YYYY-MM-DD HH24:MI:SS.MS') FROM testTable

you'll eventually get a result like
2007-10-24 13:44:48.1000
instead of
2007-10-24 13:44:49.000

#2Bruce Momjian
bruce@momjian.us
In reply to: Jose Tomas Eterovic (#1)
Re: [BUGS] BUG #3761: Problems with to_char(timestamp) and milliseconds

Jose Tomas Eterovic wrote:

The following bug has been logged online:

Bug reference: 3761
Logged by: Jose Tomas Eterovic
Email address: roleroz@gmail.com
PostgreSQL version: 8.2.4-r1
Operating system: Gentoo Linux
Description: Problems with to_char(timestamp) and milliseconds
Details:

When you use to_char to show as a string a date (including milliseconds),
there's the possibility that the number of milliseconds will be 1000 (not
between 000-999 as the documentation says)

if you have a table (called "testTable") with a single column of type
"timestamp" (called "testTimestamp") with lots of data, and you run the
query

SELECT to_char(testTimestamp, 'YYYY-MM-DD HH24:MI:SS.MS') FROM testTable

you'll eventually get a result like
2007-10-24 13:44:48.1000
instead of
2007-10-24 13:44:49.000

This is fixed in 8.3 beta with this attached patch.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://postgres.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

Attachments:

/rtmp/difftext/x-diffDownload+8-8