Re: Variable formatting of datetime with DateStyle=ISO

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Nissim <nissim(at)nksystems(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Variable formatting of datetime with DateStyle=ISO
Date: 2000-06-04 19:14:21
Message-ID: 6526.960146061@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Nissim <nissim(at)nksystems(dot)com> writes:
> I just posted a message to the interfaces list about how this is causing
> problems in th JDBC driver, and I'm wondering if there's a reason why
> the EncodeDateTime function creates a different format string depending
> on whether the date has milliseconds. Would it break anything if it
> always returned:

> yyyy-mm-dd hh:mm:ss.SSzzz

Yes: all the applications that never store fractional seconds, and are
not expecting to find fractions in their returned results. I think the
existing behavior is a reasonable compromise, and puts the burden of
extra complexity where it belongs: on the apps that are using
fractional-second timestamps.

> Also, why are there only two digits of precision on the milliseconds?
> shouldn't there be three?

The system doesn't actually store "milliseconds". Timestamp is a
floating-point format internally, and so the true resolution is variable
depending on how far away you are from time zero. Over a 100-year range
the available resolution would be more like microseconds.

Having said that, 2 fraction digits does seem like a pretty arbitrary
choice. Thomas Lockhart might know why it was done that way, but he's
gone for vacation and won't be back for a week or so...

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Vince Vielhaber 2000-06-04 20:30:34 Re: 7.0.1 Problems.
Previous Message Tom Lane 2000-06-04 18:57:06 Re: PG 7.0 crash on SELECT