Re: bug in current_timestamp(1)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
Cc: "Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: bug in current_timestamp(1)
Date: 2003-07-30 14:48:35
Message-ID: 9894.1059576515@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au> writes:
> Going from precision 3 down to 0 - note the bug in (1). It always displays
> a trailing zero.

It's not a bug, it's a feature, or at least Tom Lockhart once thought so.
See TrimTrailingZeros() in datetime.c:
/* chop off trailing zeros... but leave at least 2 fractional digits */

I don't recall the history behind that choice, and I'm disinclined to
mess with it without knowing why it was set up to do that. I have a
feeling it might have something to do with compatibility with some
non-Postgres code.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2003-07-30 15:09:28 Re: Feature request -- Log Database Name
Previous Message Tom Lane 2003-07-30 14:39:21 Re: using adbin, conbin, etc.