Cross-datatype Comparisons and Indexes - Mailing list pgsql-general

From Thomas F.O'Connell
Subject Cross-datatype Comparisons and Indexes
Date
Msg-id 56B36E80-F2E9-11D8-9218-000D93AE0944@sitening.com
Whole thread Raw
Responses Re: Cross-datatype Comparisons and Indexes  (Bruno Wolff III <bruno@wolff.to>)
Re: Cross-datatype Comparisons and Indexes  (Mike Mascari <mascarm@mascari.com>)
List pgsql-general
Since the current stable version of postgres (7.4.x) doesn't allow
cross-datatype comparisons of indexes, is it always necessary to cast
my application data explicitly in order for an index to be used, even
among the integer types?

E.g., If I have a table with a bigint primary key and application data
compared against that primary key, must I always explicitly cast the
application data to bigint if I want postgres to use the index?

SELECT * FROM some_table WHERE primary_key_column = 42

vs.

SELECT * FROM some_table WHERE primary_key_column = 42::int8

There's no way to tell postgres to treat incoming data implicitly as
the type of the column, right?

Thanks!

-tfo


pgsql-general by date:

Previous
From: "Dann Corbit"
Date:
Subject: Re: Help with optimizing query
Next
From: Bruno Wolff III
Date:
Subject: Re: Cross-datatype Comparisons and Indexes