X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 55A52475F00 for ; Wed, 26 Mar 2003 04:16:35 -0500 (EST) Received: from fzkmail2.fzk.de (fzkmail2.fzk.de [141.52.27.52]) by postgresql.org (Postfix) with SMTP id E0010475EC9 for ; Wed, 26 Mar 2003 04:16:33 -0500 (EST) Received: FROM resy5.fzk.de BY fzkmail2.fzk.de ; Wed Mar 26 10:16:33 2003 +0100 Received: œby rodos.fzk.de with ESMTP (8.8.6 (PHNE_17135)/8.7.1) id KAA20020; Wed, 26 Mar 2003 10:16:32 +0100 (MET) Message-ID: <3E816FF0.77172AE7@rodos.fzk.de> Date: Wed, 26 Mar 2003 10:16:32 +0100 From: Christoph Haller X-Mailer: Mozilla 4.77 [en] (X11; U; HP-UX B.10.20 9000/780) X-Accept-Language: en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Cc: liang.luo@convergia.net Subject: Re: How to show timestamp with milliseconds(3 digits) in Select Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: 7bit X-Spam-Status: No, hits=-10.4 required=5.0 tests=BAYES_01,QUOTED_EMAIL_TEXT,QUOTE_TWICE_1 autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200303/575 X-Sequence-Number: 12613 > > This is the query and result: > > select h323_setup_time from pv_legs_new where h323_setup_time = '2003-01-01 > 00:43:59.996-05'; > > h323_setup_time > --------------------------- > 2003-01-01 00:43:60.00-05 > > Actually, the real data of second and millisecond is 59.996-05, but it shows > 60.00. I failed to load it when I use this result in other query. > I'm using 7.3 and it works as expected: create table tstamptest ( tstampcol timestamp ); insert into tstamptest values ( '2003-01-01 00:43:59.996-05' ); select * from tstamptest ; tstampcol ------------------------- 2003-01-01 00:43:59.996 The 7.1 doc does not say anything about microsecond representation nor storage, 7.3 has Note: When timestamp values are stored as double precision floating-point numbers (currently the default), the effective limit of precision may be less than 6, since timestamp values are stored as seconds since 2000-01-01. Microsecond precision is achieved for dates within a few years of 2000-01-01, but the precision degrades for dates further away. When timestamps are stored as eight-byte integers (a compile-time option), microsecond precision is available over the full range of values. So I can only offer the standard advice: upgrade to 7.3. Regards, Christoph