Re: Index + mismatching datatypes [WAS: index on custom - Mailing list pgsql-performance

From Neil Conway
Subject Re: Index + mismatching datatypes [WAS: index on custom
Date
Msg-id 1131396357.6884.110.camel@localhost.localdomain
Whole thread Raw
In response to Index + mismatching datatypes [WAS: index on custom function; explain]  (Enrico Weigelt <weigelt@metux.de>)
List pgsql-performance
On Mon, 2005-07-11 at 19:07 +0100, Enrico Weigelt wrote:
> I've got a similar problem: I have to match different datatypes,
> ie. bigint vs. integer vs. oid.
>
> Of course I tried to use casted index (aka ON (foo::oid)), but
> it didn't work.

Don't include the cast in the index definition, include it in the query
itself:

    SELECT ... FROM foo WHERE int8col = 5::int8

for example. Alternatively, upgrade to 8.0 or better, which doesn't
require this workaround.

-Neil



pgsql-performance by date:

Previous
From: Enrico Weigelt
Date:
Subject: Index + mismatching datatypes [WAS: index on custom function; explain]
Next
From: Ralph Mason
Date:
Subject: Figuring out which command failed