Thread: index error

index error

From
Hao He
Date:
hi,

If you create a table with one of the columns defined as int8, then the
index created on this column does not work.  When I use explain to see
the plan, it is always seq scan instead of index scan as one would expect.
Other types of columns work fine (int4, string ...).

Hao

Attachment

Re: index error

From
Stephan Szabo
Date:
On Thu, 6 Dec 2001, Hao He wrote:

> hi,
>
> If you create a table with one of the columns defined as int8, then the
> index created on this column does not work.  When I use explain to see
> the plan, it is always seq scan instead of index scan as one would expect.
> Other types of columns work fine (int4, string ...).

IIRC, you need to either single quote the number or explicitly cast it
into an int8 for the index to work in general, otherwise it prematurely
makes it an int4 and then doesn't use the index.  There've been
discussions about this in the past that you can get from the archives
if you're interested.

(Info about this should probably be added to the FAQ if it's
not there, it's pretty F)