BUG #15389: Fill zero in milliseconds of a timestamp

Started by PG Bug reporting formover 7 years ago4 messagesbugs
Jump to latest
#1PG Bug reporting form
noreply@postgresql.org

The following bug has been logged on the website:

Bug reference: 15389
Logged by: Luca Taddeo
Email address: taddeoluca96@gmail.com
PostgreSQL version: 9.6.10
Operating system: Windows 7 Service Pack 2
Description:

if I try to convert a string "2014-09-26 17:17:45.990" into timestamp become
"2014-09-26 17:17:45.99"
I don't think is correct because if I try to convert in Java become 099.

In reply to: PG Bug reporting form (#1)
Re: BUG #15389: Fill zero in milliseconds of a timestamp

Hello

I don't think is correct because if I try to convert in Java become 099.

"2014-09-26 17:17:45.099"?
I think Java is incorrect here. Usually trailing zeros can be omitted.
Also postgresql timestamp has resolution 1 microsecond, so with trailing zeros it must be "2014-09-26 17:17:45.990000", not "2014-09-26 17:17:45.990".

regards, Sergei

#3David G. Johnston
david.g.johnston@gmail.com
In reply to: Sergei Kornilov (#2)
Re: BUG #15389: Fill zero in milliseconds of a timestamp

On Tuesday, September 18, 2018, Sergei Kornilov <sk@zsrv.org> wrote:

Hello

I don't think is correct because if I try to convert in Java become 099.

"2014-09-26 17:17:45.099"?
I think Java is incorrect here. Usually trailing zeros can be omitted.
Also postgresql timestamp has resolution 1 microsecond, so with trailing
zeros it must be "2014-09-26 17:17:45.990000", not "2014-09-26
17:17:45.990".

Except the decimal in that construct is a simple part separator and not a
fractional indicator. You cannot drop trailing zeros in the last part in
the same way you cannot drop trailing zeros when describing one hundred
(100) because if you do you get the number one (1) instead.

David J.
.

#4Andrew Gierth
andrew@tao11.riddles.org.uk
In reply to: David G. Johnston (#3)
Re: BUG #15389: Fill zero in milliseconds of a timestamp

"David" == David G Johnston <david.g.johnston@gmail.com> writes:

I think Java is incorrect here. Usually trailing zeros can be
omitted. Also postgresql timestamp has resolution 1 microsecond, so
with trailing zeros it must be "2014-09-26 17:17:45.990000", not
"2014-09-26 17:17:45.990".

David> Except the decimal in that construct is a simple part separator
David> and not a fractional indicator.

Both the SQL spec and ISO 8601 beg to differ.

--
Andrew (irc:RhodiumToad)