Re: [HACKERS] indexes and floats - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: [HACKERS] indexes and floats
Date
Msg-id 199808040443.AAA12363@candle.pha.pa.us
Whole thread Raw
In response to Re: [HACKERS] indexes and floats  ("Thomas G. Lockhart" <lockhart@alumni.caltech.edu>)
List pgsql-hackers
> > Ah-hah, all of a sudden this looks *real* familiar.  I bet it's
> > because pgsql is not noticing that "500.0" can be interpreted as a
> > float4. Let's try it.
>
> Oh, you have nailed it! This is interesting because (probably) a query
> like
>
>   select f4 from t4 where f4 = 500.0;
>
> is being automatically "upgraded" in the parser backend to
>
>   select f4 from t4 where float8(f4) = 500.0;
>
> So, since there is no functional index float8(f4) on the table we cannot
> use an existing index on f4 to advantage.
>
> This may be a result of my recent enhancements to the automatic type
> coersion code. But I'm a little suprised that v6.3.x doesn't just
> complain about a type mismatch but instead actually works. It may be
> that the old code which converted constants using intermediate strings
> worked (sort of) for this case. In general, the pre-enhancement code
> _only_ tried to convert constants, and complained about type mismatches
> when non-constants were involved.

Yes, it did numeric constants, I think.



--
Bruce Momjian                          |  830 Blythe Avenue
maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
  +  If your life is a hard drive,     |  (610) 353-9879(w)
  +  Christ can be your backup.        |  (610) 853-3000(h)

pgsql-hackers by date:

Previous
From: Vadim Mikheev
Date:
Subject: Re: [HACKERS] indexes and floats
Next
From: Bruce Momjian
Date:
Subject: EXPLAIN VERBOSE