Re: Index + mismatching datatypes [WAS: index on custom

From: Neil Conway <neilc(at)samurai(dot)com>
To: weigelt(at)metux(dot)de
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Index + mismatching datatypes [WAS: index on custom
Date: 2005-11-07 20:45:57
Message-ID: 1131396357.6884.110.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Ralph Mason 2005-11-07 21:30:15 Figuring out which command failed
Previous Message Enrico Weigelt 2005-11-07 18:07:38 Index + mismatching datatypes [WAS: index on custom function; explain]