Re: Bugs in bigint indexes

From: "jmm" <jmm(at)cvni(dot)net>
To: "Gustavo Scotti" <gscotti(at)axur(dot)com(dot)br>, <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: Bugs in bigint indexes
Date: 2003-12-19 17:58:24
Message-ID: 005201c3c65a$1c549f50$8201020a@eden.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

MessageTry this

explain SELECT id FROM it_test WHERE id='123';
QUERY PLAN
----------------------------------------------------------------------------
Index Scan using it_test_pkey on it_test (cost=0.00..4.82 rows=1 width=8)
Index Cond: (id = 123::bigint)
(2 rows)

The point is that 123 is naturally considered by Postgres to be an int4. If you want to specify it is an int8 then use quotes around your value or an explicit cast if the sought value is some kind of int4, int2 attribute.

The same apply for smallints.

----- Original Message -----
From: Gustavo Scotti
To: pgsql-bugs(at)postgresql(dot)org
Sent: Wednesday, December 17, 2003 8:56 PM
Subject: [BUGS] Bugs in bigint indexes
I almost got nuts those two days I'm stuck with this issue...
Let's get straight to the point. I'm using a small portion of my actual table, but this is enough.

CREATE SEQUENCE it_seq;
CREATE TABLE it_test (
id bigint not null primary key default nextval('public.it_test_id_seq'::text)
);

explain SELECT id FROM it_test WHERE id=123;
Seq Scan on it_test (cost=0.0..22.50 rows=2 width=8)
Filter: (id=123)
(2 rows)

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Eisentraut 2003-12-19 18:00:34 Re: Bugs in bigint indexes
Previous Message PostgreSQL Bugs List 2003-12-19 17:57:31 BUG #1021: IDENT authorization doesn't work