Re: Bug in CAST() with time data types

From: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>
To: Alvaro Herrera <alvherre(at)protecne(dot)cl>, contribs(at)mandrakesoft(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Bug in CAST() with time data types
Date: 2000-12-16 05:30:12
Message-ID: 3A3AFDE4.8A6A100F@alumni.caltech.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

> Compiler used (example: gcc 2.8.0) : RPM for Mandrake Linux
...
> When inserting timestamps or interval types whose precision is one full
> minute, Postgres substracts one minute from the data and add 60 seconds
> (00:01:00 becomes 00:00:60). Later, when reading this data Postgres says
> "Bad timestamp external representation '2000-12-14 18:25:60.00-03'" and
> refuses to understand it.
...
> Sorry, I don't even know where to look. It is probably a bug in the way
> CAST() treats it's arguments, when dealing with time data types.

No, unfortunately it is a bug in the way Mandrake builds their RPMs :(

The default compiler flags for RPM building under Mandrake include both
"-O3" (shrunk to "-O2" explicitly by the PostgreSQL RPM build) and
"-ffast-math". The GNU gcc folks strongly recommend against mixing these
two flags!

afaict the *only* symptom of this misuse of the gcc compiler for
PostgreSQL is the symptom that you see, with incorrect rounding in the
date/time types.

I've posted a corrected .rpmrc file on ftp.postgresql.org in the
/pub/binary area if you want to repair this by rebuilding this from
.src.rpm. And if you know a way to get in touch with the Mandrake RPM
builders that would be helpful; I have not had the time to subscribe to
the cooker mailing list to try to work out this issue.

In the meantime pick up RPMs from the PostgreSQL ftp site, which have
this problem corrected by building against the above-mentioned .rpmrc
file.

I've cross-posted this to the RPM contact address for Mandrake (hi!) and
would be happy to provide more information.

- Thomas

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2000-12-16 06:38:33 Table name scope (was Re: Outer joins aren't working with views)
Previous Message Thomas Lockhart 2000-12-16 05:16:22 Re: Outer joins aren't working with views