From: | Christoph Haller <ch(at)rodos(dot)fzk(dot)de> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Cc: | liang(dot)luo(at)convergia(dot)net |
Subject: | Re: How to show timestamp with milliseconds(3 digits) in Select |
Date: | 2003-03-26 09:16:32 |
Message-ID: | 3E816FF0.77172AE7@rodos.fzk.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
>
> 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
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Childs | 2003-03-26 09:50:24 | Re: Does anyone use TO_CHAR(INTERVAL)? |
Previous Message | Tomasz Myrta | 2003-03-26 08:17:18 | Re: Does anyone use TO_CHAR(INTERVAL)? |