Re: plpgsql and index usage

From: Ryan Mahoney <ryan(at)flowlabs(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: plpgsql and index usage
Date: 2002-12-21 07:47:20
Message-ID: mt680v00mlf17bn0kdogui0s8i6b5vbqln@4ax.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>Ryan Mahoney <ryan(at)flowlabs(dot)com> writes:
>> Index Scan using pa_zipcode_proximity_pk on pa_zipcode_proximity (cost=
>> 0.00..13.53 rows=3 width=862)
>> Index Cond: ((zipcode = '11103'::bpchar) AND (proximity <= 100))
>> (183 rows)
>
>Hmm ... evidently zipcode is declared as type char(5) (note the "bpchar"
>coercion). Is the plpgsql variable it's being compared to declared the
>same way? This could be ye olde cross-datatype-coercion problem.

Interesting! I think in plpgsql the data type of the argument coming
in to the function is "text". Are you suggesting that I:
a. use a different datatype in plpgsql or
b. cast the values or
c. change the data type in the table

I am not familiar with the bpchar type, but I am looking into it now.

Thanks!

-r

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hans-Jürgen Schönig 2002-12-21 09:48:05 Re: Resource management in 7.4
Previous Message Tom Lane 2002-12-21 05:20:56 Re: Resource management in 7.4