Re: SELECT with REAL...

Поиск
Список
Период
Сортировка
От Steve Atkins
Тема Re: SELECT with REAL...
Дата
Msg-id 5D09DBCD-9DB4-4A0C-A8BE-FB0C0EEFB9BA@blighty.com
обсуждение исходный текст
Ответ на SELECT with REAL...  (Philippe Ferreira <phil.f@worldonline.fr>)
Ответы Re: SELECT with REAL...
Re: SELECT with REAL...
Список pgsql-general
On Feb 5, 2006, at 2:30 PM, Philippe Ferreira wrote:

> Hi,
>
> I've never noticed before, but I don't manage to do a "SELECT" with
> conditions on REAL columns !!
>
> For example, the following command always returns 0 row, even if
> rows with myreal=10.5 do exist :
>     SELECT * FROM mytable WHERE myreal=10.5;
>
> Where am I wrong ?!

Comparing two floating point numbers for equality seldom works
the way you want it to.

Without seeing the exact data you have it's hard to say for sure (as
there
may be some other issue with what you're doing) but I wouldn't expect
this to work with data from arbitrary sources.

Try

   SELECT * FROM mytable WHERE myreal >= 10.49 AND myreal <= 10.51;

and see what result that gives.

Cheers,
   Steve


В списке pgsql-general по дате отправления:

Предыдущее
От: Michael Glaesemann
Дата:
Сообщение: Re: SELECT with REAL...
Следующее
От: Tyler MacDonald
Дата:
Сообщение: Neat trick to make sure plpgsql is installed as part of a schema