Re: timestamp_part() bug?

From: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
To: Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: timestamp_part() bug?
Date: 2002-02-27 08:52:51
Message-ID: 20020227095251.D24777@zf.jcu.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Feb 27, 2002 at 05:07:50PM +0900, Tatsuo Ishii wrote:
> I see following in the manual:
>
> -------------------------------------------------------------------
> The seconds field, including fractional parts, multiplied by
> 1000. Note that this includes full seconds.
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> SELECT EXTRACT(MILLISECONDS FROM TIME '17:12:28.5');
> Result: 28500
> -------------------------------------------------------------------
>
> And I see:
>
> test=# select current_timestamp,extract(milliseconds from current_timestamp);
> timestamptz | date_part
> -------------------------------+-----------
> 2002-02-27 14:45:53.945529+09 | 945.529
> (1 row)
>
> Apparently there's an inconsistency among manuals, timestamp(tz)_part
> and timetz_part. Does anybody know which one is correct?

I hope bug is in the manual -- for example minutes the "extract" returns
without hours. Is any matter why returs millisecons with seconds?
If somebody wants milliseconds with seconds:

# select extract(SECONDS from '14:45:53.945529'::time) * 1000;
?column?
------------------
53945.5289999969
(1 row)


BTW, to_char() retuns milliseconds without seconds too:

test=# select to_char('2002-02-27 14:45:53.945529+09'::timestamp, 'MS');
to_char
---------
946
(1 row)

Karel

--
Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
http://home.zf.jcu.cz/~zakkr/

C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Zeugswetter Andreas SB SD 2002-02-27 09:19:40 Re: COPY incorrectly uses null instead of an empty string in last field
Previous Message Dave Page 2002-02-27 08:34:28 Re: Rename sequence bug/feature