Going from precision 3 down to 0 - note the bug in (1).  It always displays
a trailing zero.

australia=# select current_timestamp(3);
        timestamptz
----------------------------
 2003-07-30 10:54:55.642+08
(1 row)

australia=# select current_timestamp(2);
        timestamptz
---------------------------
 2003-07-30 10:54:57.11+08
(1 row)

australia=# select current_timestamp(1);
        timestamptz
---------------------------
 2003-07-30 10:54:58.20+08
(1 row)

australia=# select current_timestamp(0);
      timestamptz
------------------------
 2003-07-30 10:55:03+08
(1 row)



Chris


Wed, 30 Jul 2003 10:59:04 +0800
"Christopher Kings-Lynne" <chriskl@familyhealth.com.au>
bug in current_timestamp(1)
"Christopher Kings-Lynne" <chriskl@familyhealth.com.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

Wed, 30 Jul 2003 10:48:35 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: bug in current_timestamp(1) 