From: | Richard Huxton <dev(at)archonet(dot)com> |
---|---|
To: | Fernando Kasten Peinado <fernandopeinado(at)uol(dot)com(dot)br> |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #1326: Unique and Primary Key index over bigint type |
Date: | 2004-11-19 15:52:19 |
Message-ID: | 419E16B3.3040503@archonet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
PostgreSQL Bugs List wrote:
> The following bug has been logged online:
>
> Bug reference: 1326
> Logged by: Fernando Kasten Peinado
>
> Email address: fernandopeinado(at)uol(dot)com(dot)br
>
> PostgreSQL version: 7.4.5
>
> Operating system: Linux RedHat 7.3
>
> Description: Unique and Primary Key index over bigint type doesn't
> work
>
> Details:
>
> index is not used when Type is bigint.
This is a known issue with versions prior to 8.0. When you provide a
constant integer smaller than 2^31 it assumes you want int4. Of course,
the planner then looks for an int4 index and can't find one.
The solution/workaround is to make sure you specify the type of your
constant, or at least make sure it doesn't look like an int4.
select * from x where x.id = 12345::int8;
select * from x where x.id = CAST(12345 AS int8);
select * from x where x.id = '12345';
The last works because '...' is type unknown so it looks at x.id to see
what type it wants and casts for you.
HTH
--
Richard Huxton
Archonet Ltd
From | Date | Subject | |
---|---|---|---|
Next Message | Josh Berkus | 2004-11-20 01:02:52 | Wrong version of INIT script in postgresql-7.3.8-3PGDG.i686.rpm |
Previous Message | PostgreSQL Bugs List | 2004-11-19 14:25:17 | BUG #1326: Unique and Primary Key index over bigint type doesn't work |