float8 comparison failure

From: Radek Kanovsky <rk(at)dat(dot)cz>
To: pgsql-bugs(at)hub(dot)org
Subject: float8 comparison failure
Date: 2000-07-28 13:02:35
Message-ID: 20000728150235.I906@dat.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

============================================================================
POSTGRESQL BUG REPORT TEMPLATE
============================================================================

Your name : Radek Kanovsky
Your email address : rk(at)dat(dot)cz

System Configuration
---------------------
Architecture (example: Intel Pentium) : PC - AMD K6 3D

Operating System (example: Linux 2.0.26 ELF) : Linux 2.2.16 (Debian)

PostgreSQL version (example: PostgreSQL-6.5.3): PostgreSQL-6.5.3
(6.5.1, 6.5.2)

Compiler used (example: gcc 2.8.0) : gcc 2.95.2
libc6 2.1.3

Please enter a FULL description of your problem:
------------------------------------------------

I have one table defined as follows

CREATE TABLE misto (
idm VARCHAR(8) NOT NULL PRIMARY KEY,
nazev VARCHAR(64) NOT NULL,
okres VARCHAR(2) NOT NULL,
sourad_s FLOAT,
sourad_d FLOAT,
modifikace DATETIME NOT NULL DEFAULT now(),
modifikoval VARCHAR(32) NOT NULL DEFAULT getpgusername()
) ;
CREATE INDEX misto_okres ON misto (okres);
CREATE INDEX misto_nazev ON misto (nazev);

These three SELECTs don't return same result:

SELECT idm,sourad_s,sourad_d FROM misto WHERE idm = 'MHO00179';
idm | sourad_s| sourad_d
--------+-------------+-------------
MHO00179|48.9247114069|17.6064515081
(1 row)

SELECT idm,sourad_s,sourad_d FROM misto WHERE sourad_s = 48.9247114069;
idm | sourad_s| sourad_d
--------+-------------+-------------
MHO00179|48.9247114069|17.6064515081
(1 row)

SELECT idm,sourad_s,sourad_d FROM misto WHERE sourad_d = 17.6064515081;
idm|sourad_s|sourad_d
---+--------+--------
(0 rows)

Please describe a way to repeat the problem. Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------

The problem appears randomly. I havent found any relation
with anything else. I often use Python interface for INSERT,
UPDATE, SELECT.

If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------

This helps:

BEGIN;
UPDATE misto SET sourad_d = 17.6064515081 WHERE idm = 'MHO00179';
END;

SELECT idm,sourad_s,sourad_d FROM misto WHERE sourad_d = 17.6064515081;
idm | sourad_s| sourad_d
--------+-------------+-------------
MHO00179|48.9247114069|17.6064515081

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2000-07-28 15:16:15 Re: float8 comparison failure
Previous Message Tom Lane 2000-07-27 23:56:21 Re: Bug with 'iscachable' attribute (Was: Index selection bug)