Re: select fails on indexed varchars.

From: Alex Krohn <alex(at)gossamer-threads(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: select fails on indexed varchars.
Date: 2001-01-29 23:13:41
Message-ID: 20010129151152.2507.ALEX@gossamer-threads.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi Tom,

> >> What does EXPLAIN VERBOSE select * from foo where a like 'Test/%';
> >> show?
>
> Well, the indexqual is just what it should be for C locale:
>
> :indxqual ((
> { EXPR :typeOid 16 :opType op :oper
> { OPER :opno 1061 :opid 1052 :opresulttype 16 } :args (
> { VAR :varno 1 :varattno 1 :vartype 1042 :vartypmod 29 :varlevelsup 0 :varnoold 1 :varoattno 1}
> { CONST :consttype 1042 :constlen -1 :constisnull false :constvalue 9 [ 9 0 0 0 84 101 115 116 47 ] :constbyval false })}
> { EXPR :typeOid 16 :opType op :oper
> { OPER :opno 1058 :opid 1049 :opresulttype 16 } :args (
> { VAR :varno 1 :varattno 1 :vartype 1042 :vartypmod 29 :varlevelsup 0 :varnoold 1 :varoattno 1}
> { CONST :consttype 1042 :constlen -1 :constisnull false :constvalue 9 [
> 9 0 0 0 84 101 115 116 48 ] :constbyval false })}))
>
> This mess translates as
>
> a >= 'Test/'::bpchar AND a < 'Test0'::bpchar
>
> which is what the LIKE index optimizer is supposed to generate.
> I infer that one or the other of these conditions yields false on your
> machine, which should not be happening if the thing is in C locale.

Here's what I get:

links=# select * from foo where a >= 'Test/'::bpchar;
a
---------------------------
Test/Test
(1 row)

links=# select * from foo where a < 'Test0'::bpchar;
a
---
(0 rows)

links=#

Are you saying the second test should have returned true under C locale?

Is this a version dependant bug? Will downgrading to 6.x get me going?

Cheers,

Alex

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2001-01-30 01:44:49 Re: select fails on indexed varchars.
Previous Message Tom Lane 2001-01-29 22:29:06 Re: Problem with inet/cidr convert functions