Обсуждение: select real returns nothing

Поиск
Список
Период
Сортировка

select real returns nothing

От
Chris Sutton
Дата:
I'm getting some weird things happen when trying to search for a specific row in a table that contains "real" types.

Here is my table structure

table units (
    unit_id    int4,
    price_unit    varchar(10),
    unit_cov    real,
    unit_wt    real);

The following row exists in the units table

 unit_id | price_unit | unit_cov | unit_wt
 ---------+------------+----------+---------
    47430 | LF         |       12 |   4.833

The following query returns no rows:

SELECT unit_id FROM units
WHERE price_unit='LF' and unit_cov=12 and unit_wt=4.833;

While these queries return the correct unit_id

SELECT unit_id FROM units
WHERE price_unit='LF' and unit_cov='12' and unit_wt='4.833';

SELECT unit_id FROM units
WHERE price_unit='LF' and unit_cov='12' and unit_wt=float4(4.833);

I'm running pg7.2.1 on Linux.

The curious thing is I have a development database running pg7.1 on linux where I don't have this problem.