Re: 7.3.2 indexes in PL/PgSQL

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Evgeny Duzhakow <diabolo(at)philol(dot)msu(dot)ru>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: 7.3.2 indexes in PL/PgSQL
Date: 2003-04-25 20:16:00
Message-ID: 29607.1051301760@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Evgeny Duzhakow <diabolo(at)philol(dot)msu(dot)ru> writes:
> SELECT playerid FROM players WHERE nickname = 'qq' AND password = 'qqq';
> [ does an index scan ]
> but in procedure on PL/PgSQL this select realy do sequense scan:

I'd bet that you were sloppy about datatypes. Postgres will
automatically interpret those quoted literals as being the same datatype
as what they were compared to, but there's no such free lunch when
you're dealing with declared variables in a plpgsql function. If the
datatypes don't match you probably won't get an index scan. Change the
types to match or add explicit coercions.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2003-04-25 20:17:48 Re: postgres sql 7.1.1
Previous Message Oliver Elphick 2003-04-25 18:40:44 Re: BUG: Infinite syslog() loop