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

From Alex Krohn
Subject select fails on indexed varchars.
Date
Msg-id 20010124174853.86A5.ALEX@gossamer-threads.com
Whole thread Raw
Responses Re: select fails on indexed varchars.
List pgsql-bugs
Hi,

First off I'm running:

links=# select version() ;
                               version
---------------------------------------------------------------------
 PostgreSQL 7.0.3 on i686-pc-linux-gnu, compiled by gcc egcs-2.91.66
(1 row)

Now, if I have a table with an index, I'm not able to do some selects on
it. To reproduce:

        links=# create table foo ( a char(25) );
        CREATE
        links=# create index foodx on foo (a);
        CREATE
        links=# insert into foo values ('Test/Test');
        INSERT 29689 1
        links=# select * from foo;
                     a
        ---------------------------
         Test/Test
        (1 row)

        links=# select * from foo where a like 'Test/%'
        links-# ;
         a
        ---
        (0 rows)

# Strange result, why 0 rows, the select failed.

        links=# select * from foo where a like 'Test%';
                     a
        ---------------------------
         Test/Test
        (1 row)

# This one's fine.

        links=# select * from foo where a like 'Test/T%';
                     a
        ---------------------------
         Test/Test
        (1 row)

# And so is this one.

It seems the /% causes a problem. If I drop the index, the selects work
fine. Is this a bug, am I missing something? If you need any other
system info, please let me know. I did an RPM install on a pretty plain
Redhat 6.2 system.

Please reply to alex@gossamer-threads.com with any ideas.

Thanks!

Alex

--------------------  Gossamer Threads Inc.  ----------------------
Alex Krohn                        Email: alex@gossamer-threads.com
Internet Consultant               Phone: (604) 687-5804
http://www.gossamer-threads.com   Fax  : (604) 687-5806

pgsql-bugs by date:

Previous
From: aoki@acm.org (Paul M. Aoki)
Date:
Subject: Re: no way in LargeObject API to detect short read?
Next
From: Bruno Wolff III
Date:
Subject: Re: round - timestamp bug