Re: BUG #5877: problem with wild char used in where clause

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Savita" <savita(dot)halli(at)gmail(dot)com>,<pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #5877: problem with wild char used in where clause
Date: 2011-02-10 19:37:29
Message-ID: 4D53EA19020000250003A7B8@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Savita" <savita(dot)halli(at)gmail(dot)com> wrote:

> PostgreSQL version: 8.3.5

> I have a table with id as primary key.

> When I ran query to get the ids which ends with B1
> select id from table where id like '%B1'
> does not return me any rows.

You might want to check all the bug fixes listed in the 8.3 bug fix
releases since the 2008 version you're running:

http://www.postgresql.org/docs/8.3/static/release.html

Then consider an in-place upgrade:

http://www.postgresql.org/support/versioning

and see if the problem is still there. It doesn't exist on the more
current releases I'm running. For example:

test=# create table t (id text not null primary key);
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
"t_pkey" for table "t"
CREATE TABLE
test=# insert into t values ('AB1'),('AB2'),('AB3'),('AB4');
INSERT 0 4
test=# select id from t;
id
-----
AB1
AB2
AB3
AB4
(4 rows)

test=# select id from t where id like 'A%';
id
-----
AB1
AB2
AB3
AB4
(4 rows)

test=# select id from t where id like '%B1';
id
-----
AB1
(1 row)

If you apply the available 8.3 bug fixes and still see the problem,
creating a self-contained test case like the above will allow others
to better help you.

-Kevin

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message hubert depesz lubaczewski 2011-02-10 19:40:44 Re: BUG #5877: problem with wild char used in where clause
Previous Message Jan-Peter Seifert 2011-02-10 12:56:53 BUG #5878: BTREE_BUILD_STATS causes 'make check' to fail