Re: Why does postgres not take into account my index on a bigint column ?

From: Andrew Sullivan <andrew(at)libertyrms(dot)info>
To: PostgreSQL general list <pgsql-general(at)postgresql(dot)org>
Subject: Re: Why does postgres not take into account my index on a bigint column ?
Date: 2002-04-15 16:57:37
Message-ID: 20020415125737.J25319@mail.libertyrms.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Apr 15, 2002 at 08:16:38AM -0700, Michael Loftis wrote:
> IMHO this is a bug in PostgreSQL.... Ints of any type are not supposed
> to be quoted, and whether-or-not they are shouldn't affect the planning
> and execution of the query...

This is a well-known problem with bigint. The problem is really in
the handling of the datatype: for some reason (the details were in a
recent thread about the issue), the values get interpreted as int4
and there is no automatic cast to int8.

When you quote the value, it gets treated as type unknown, and then
gets cast correctly. There's been quite a bit of discussion, ISTM,
about how to fix it, but no consensus.

> Pierre-Andre Michel wrote:
>
> > Hi,
> >
> >
> >
> > I noticed that postgres does not take into account index on BIGINT
> > column when the value specified in the WHERE condition is not quoted.

> > So does anybody know a way to force postgres to consider using indices
> > on bigint columns even when the value in a where cond is not
> > surrounded by quotes ?

The alternative to quotes is to use an explicit cast.

A

--
----
Andrew Sullivan 87 Mowat Avenue
Liberty RMS Toronto, Ontario Canada
<andrew(at)libertyrms(dot)info> M6K 3E3
+1 416 646 3304 x110

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tarabas 2002-04-15 17:02:16 Strange Update-Bug in postgres (is it a feature?) ?!
Previous Message Michael Devogelaere 2002-04-15 16:41:19 psql and passwords