Re: round - timestamp bug

From: William Boyle <woboyle(at)ieee(dot)org>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Re: round - timestamp bug
Date: 2001-02-07 14:50:15
Message-ID: 3A8160A3.B4BA2610@ieee.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Gonzalo Arana wrote:
>
> ============================================================================
> POSTGRESQL BUG REPORT TEMPLATE
> ============================================================================
>
> Your name : Gonzalo Arana
> Your email address : garana(at)sinectis(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2001-02-07 14:55:57 Re: BUG or feature?
Previous Message Max Vaschenko 2001-02-07 12:26:05 BUG or feature?