Re: Quoting affects usage of indices on int8 columns...

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Vincent Trussart <trussarv(at)CIRANO(dot)UMontreal(dot)CA>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Quoting affects usage of indices on int8 columns...
Date: 2000-08-28 17:04:17
Message-ID: Pine.BSF.4.10.10008280939470.50694-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)bigpanda(dot)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".

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2000-08-28 17:46:49 Re: lo_creat() failing after 22 iterations
Previous Message Anthony Marino 2000-08-28 16:01:34 java.sql.SQLException: ERROR: