Re: Quoting affects usage of indices on int8 columns... - Mailing list pgsql-general

From Stephan Szabo
Subject Re: Quoting affects usage of indices on int8 columns...
Date
Msg-id Pine.BSF.4.10.10008280939470.50694-100000@megazone23.bigpanda.com
Whole thread Raw
In response to Quoting affects usage of indices on int8 columns...  (Vincent Trussart <trussarv@CIRANO.UMontreal.CA>)
List pgsql-general
This has come up before so a more complete explanation should be in the
archives (and a discussion of typing came up on hackers in May-June
although I don't know if there was a resolution).

IIRC, the problem is due to the typing of the 1 constant into an
int4.  Unfortunately the normal workaround has been to explicitly
cast the constant, although you may not be able to do that if
you can't change the queries.  Other than that or using an int4
column, I don't remember seeing any effective workarounds but the
archives may turn something up.

Stephan Szabo
sszabo@bigpanda.com

On Thu, 24 Aug 2000, Vincent Trussart wrote:

> Is it normal that this query will be performed using sequential scan
> (as reported by explain) :
>
> SELECT b FROM test WHERE a=1;
>
> while this one will use the index on a?
>
> SELECT b FROM test WHERE a='1';
>
>
> It seems that the quoting affects the way the query is performed
> when the index is on a column on type "int8".  The index is used
> when the column type is "int".


pgsql-general by date:

Previous
From: Anthony Marino
Date:
Subject: java.sql.SQLException: ERROR:
Next
From: Tom Lane
Date:
Subject: Re: lo_creat() failing after 22 iterations