Re: How to use index in WHERE int = float

Поиск
Список
Период
Сортировка
От Scott Marlowe
Тема Re: How to use index in WHERE int = float
Дата
Msg-id dcc563d10811051348s1320409cw1bbc712fc4107545@mail.gmail.com
обсуждение исходный текст
Ответ на Re: How to use index in WHERE int = float  ("Andrus" <kobruleht2@hot.ee>)
Ответы Re: How to use index in WHERE int = float  ("Andrus" <kobruleht2@hot.ee>)
Список pgsql-general
On Wed, Nov 5, 2008 at 2:42 PM, Andrus <kobruleht2@hot.ee> wrote:
>> Stop trying to compare exact and inexact types?
>>
>> You do realize that a float is not an exact number.  What you and I
>> see as 1228137 might really be, internally, 1228136.9999999999999999 ?
>> So it won't get an exact match.  What's wrong with trying to match to
>> an exact number instead?
>
> My query contains
>
> '1228137'::float8
>
> I do'nt see
>
> 1228136.9999999999999999
>
> in this query.

Did you read what I wrote?  Cause you just repeated it as an argument
against my point.

 I don't think you get the difference between exact and inexact types.
 Google it for more comprehensive reading on the subject.

> Those strange casts are auto-generated by ODBC parameter passing software
> which I must use so I must live with it.

Sorry to hear that.

PostgreSQL doesn't automatically use indexes when comparing
incompatible types (i.e. exact versus non-exact types) so it's up to
you to use casting to make them match up.  There are lots of things
you can do here, but if you're comparing ints with floats you will
eventually be bitten by some comparison that should match but doesn't.
 Stick to exact number types if possible.

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

Предыдущее
От: "Andrus"
Дата:
Сообщение: Re: How to use index in WHERE int = float
Следующее
От: Sam Mason
Дата:
Сообщение: Re: How to use index in WHERE int = float