Re: select fails on indexed varchars. - Mailing list pgsql-bugs

From Alex Krohn
Subject Re: select fails on indexed varchars.
Date
Msg-id 20010129151152.2507.ALEX@gossamer-threads.com
Whole thread Raw
In response to Re: select fails on indexed varchars.  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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

pgsql-bugs by date:

Previous
From: juan@netsoc.tcd.ie (Juan Flynn)
Date:
Subject: timestamp/date bug
Next
From: Myron Scott
Date:
Subject: PROC struct