Re: Unexpected query plan - Mailing list pgsql-general

From Stephan Szabo
Subject Re: Unexpected query plan
Date
Msg-id Pine.BSF.4.21.0105220824520.62173-100000@megazone23.bigpanda.com
Whole thread Raw
In response to Unexpected query plan  ("Dave Cramer" <Dave@micro-automation.net>)
List pgsql-general
When you aren't putting the quotes, the type of the numeric constant
gets int4 which won't match bigint so it doesn't realize it can
use the index.  You can explicitly type it with ::bigint which should
make it use the index as well (current workaround until numeric types
get handled in a more happy way).  For more details see archives.

On Tue, 22 May 2001, Dave Cramer wrote:

>
> Hi All,
>
> Below is a simple table with an index on phonenumber, if I do a select on
> phonenumber without quotes then it does a sequence scan?? If I do put
> quotes, then it does use the index scan??? Anyone know what's going on?
>
> The version of postgres is 7.1
>
> Regards,
>
> Dave
>
> test=# create table custbase (phonenumber int8, svctype char, svcchoice
> char, billtype char, ctype char);
> CREATE
> test=# create index custbaseidx on custbase (phonenumber);
> CREATE
> test=# \d custbase
>            Table "custbase"
>   Attribute  |     Type     | Modifier
> -------------+--------------+----------
>  phonenumber | bigint       |
>  svctype     | character(1) |
>  svcchoice   | character(1) |
>  billtype    | character(1) |
>  ctype       | character(1) |
> Index: custbaseidx


pgsql-general by date:

Previous
From: "Denis A. Doroshenko"
Date:
Subject: Re: psql shell problem
Next
From: "Oliver Elphick"
Date:
Subject: Re: ZeroFill(.../pg_xlog/xlogtemp.20148) failed: No such file or directory