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

Поиск
Список
Период
Сортировка
От Andrew Sullivan
Тема Re: Why does postgres not take into account my index on a bigint column ?
Дата
Msg-id 20020415125737.J25319@mail.libertyrms.com
обсуждение исходный текст
Ответ на Re: Why does postgres not take into account my index on a bigint column ?  (Michael Loftis <mloftis@wgops.com>)
Список 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@libertyrms.info>                              M6K 3E3
                                         +1 416 646 3304 x110


В списке pgsql-general по дате отправления:

Предыдущее
От: Moritz Sinn
Дата:
Сообщение: function for creating random id
Следующее
От: Philip Reimer
Дата:
Сообщение: User-Defined Datatypes