Re: round - timestamp bug - Mailing list pgsql-bugs

From William Boyle
Subject Re: round - timestamp bug
Date
Msg-id 3A8160A3.B4BA2610@ieee.org
Whole thread Raw
In response to round - timestamp bug  (Gonzalo Arana <garana@sinectis.com.ar>)
Responses Re: Re: round - timestamp bug  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
Gonzalo Arana wrote:
>
> ============================================================================
>                         POSTGRESQL BUG REPORT TEMPLATE
> ============================================================================
>
> Your name          : Gonzalo Arana
> Your email address : garana@sinectis.com
>
> System Configuration
> ---------------------
>   Architecture (example: Intel Pentium)         :  Intel Pentium III
>
>   Operating System (example: Linux 2.0.26 ELF)  :  Linux 2.2.12-20 ELF
> (libc-2.1.2)
>
>   PostgreSQL version (example: PostgreSQL-7.0):   PostgreSQL-7.0.3
>
>   Compiler used (example:  gcc 2.8.0)           :  egcs-2.91.66
>
> Please enter a FULL description of your problem:
> ------------------------------------------------
>
> It seems that there is a problem when retrieving a timestamp value (rounding).
>
> NO minute has 61 seconds.  Am I wrong?
>
> Please describe a way to repeat the problem.   Please try to provide a
> concise reproducible example, if at all possible:
> ----------------------------------------------------------------------
>
> radius=# create table x (x timestamp);
> CREATE
> radius=# insert into x (x) values ('Tue 23 Jan 21:38:59.997 2001');
> INSERT 619178 1
> radius=# select * from x;
>                 x
> ---------------------------------
>  Tue 23 Jan 21:38:60.00 2001 ART
> (1 row)
>
> If you know how this problem might be fixed, list the solution below:
> ---------------------------------------------------------------------
>
> Ugly patch to scripts:
>
> radius=# select to_char(x,'Dy DD Mon HH24:MI:SS YYYY') from x;
>          to_char
> --------------------------
>  Tue 23 Jan 21:38:59 2001
> (1 row)
>
> Of course, you'll lose the fraction of seconds otherwise are available.


Actually, such leap-seconds are possible. This can happen when your
timebase is a NTP time server such as the Naval Observatory, etc. They
are used for micro adjustments to adjust clock to siderial (celestial)
time. I have had to write date+time classes in C++ which could handle
this exact situation... X-). The fact that Postgres-SQL can handle this
is probably a good thing.

-Bill Boyle

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: byteain() doesn't parse correctly
Next
From: Tom Lane
Date:
Subject: Re: Re: round - timestamp bug