Skip site navigation (1) Skip section navigation (2)

Cross-datatype Comparisons and Indexes

From: Thomas F(dot)O'Connell <tfo(at)sitening(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Cross-datatype Comparisons and Indexes
Date: 2004-08-20 20:41:40
Message-ID: (view raw, whole thread or download thread mbox)
Lists: 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


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?




pgsql-general by date

Next:From: Peter EisentrautDate: 2004-08-20 20:56:56
Subject: Re: 8.0 release schedule?
Previous:From: Dann CorbitDate: 2004-08-20 20:32:33
Subject: Re: Help with optimizing query

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group