like operator bug

From: jfaith <jfaith(at)cemsys(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: like operator bug
Date: 1999-09-07 12:35:36
Message-ID: 37D50698.246E4627@cemsys.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Your name : Jeremy Faith
Your email address :jfaith(at)cemsys(dot)com

System Configuration
---------------------
Architecture (example: Intel Pentium) :Intel Pentium

Operating System (example: Linux 2.0.26 ELF) : Linux 2.0.36

PostgreSQL version (example: PostgreSQL-6.5.1): PostgreSQL-6.5.1

Compiler used (example: gcc 2.8.0) : gcc 2.7.2.3

Please enter a FULL description of your problem:
------------------------------------------------
The percent charater(%) is not functioning correctly in arguments to the
like(~~) operator. Many matches are being missed.
Also the bug tracking system at
http://www.PostgreSQL.ORG/bugs/visitor.php3
is not functioning(I reported this like bug about 2 weeks ago slip 72 I
think).
The output I get now starts with
Warning: PostgresSQL query failed: ERROR: status: Permission denied.
in ./postgres.php3 on line 40.

Please describe a way to repeat the problem. Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------
create table tst(addr char(4));
insert into tst values('1000');
insert into tst values('1010');
insert into tst values('1120');
select * from tst where addr like '1%0';

produces

addr
----
1120(1 row)

where it should return all of the example rows.

If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------
In the file ./src/backend/utils/adt/like.c

The function DoMatch appears to have been optimised to return LIKE_ABORT
when
the pattern cannot be matched. However in the above instance it
incorrectly
aborts causing the like function to return FALSE. I think this could be
fixed
by changing the recursuve call from
(matched=DoMatch(text,p))!=LIKE_FALSE
to
(matched=DoMatch(text,p))==LIKE_TRUE
at the expense of some speed, there may be a more efficient solution,
but it
needs a fix.
It may be that the aborting concept is flawed.

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 1999-09-07 13:43:22 Re: [BUGS] like operator bug
Previous Message Tom Lane 1999-09-06 23:27:49 Re: [BUGS] temp tables failes in transaction mode