Skip site navigation (1) Skip section navigation (2)

select fails on indexed varchars.

From: Alex Krohn <alex(at)gossamer-threads(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: select fails on indexed varchars.
Date: 2001-01-25 01:58:31
Message-ID: 20010124174853.86A5.ALEX@gossamer-threads.com (view raw or flat)
Thread:
Lists: 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(at)gossamer-threads(dot)com with any ideas.

Thanks!

Alex

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


Responses

pgsql-bugs by date

Next:From: Bruce MomjianDate: 2001-01-25 03:31:38
Subject: Re: [INTERFACES] jdbc driver: Support for 'BOOL'
Previous:From: Bruce MomjianDate: 2001-01-25 00:04:03
Subject: Re: no way in LargeObject API to detect short read?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group