Re: BUG #5478: ILIKE operator returns wrong result

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Markus <markus(dot)herven(at)outpost24(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5478: ILIKE operator returns wrong result
Date: 2010-05-28 15:51:08
Message-ID: 26362.1275061868@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Bruce Momjian <bruce(at)momjian(dot)us> writes:
> Tom Lane wrote:
>> If tlen == 0 when we reach this loop, we'll fall through and fail.
>> But that is wrong since we need to consider the possibility that
>> the remaining pattern can match a zero-length substring. So the
>> loop needs to be changed to attempt a recursive MatchText for
>> tlen equal to zero as well as greater than zero.

> I took a different approach. I think the problem is that we check for
> end of pattern without consuming '%' patterns. I copied that consume
> loop from code above that where we also test for end of pattern.

> With the attached patch (which includes a regression test addition), it
> works fine:

No, that patch is just plain wrong. It eats %'s that would affect
the later recursive MatchText calls.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2010-05-28 16:11:40 Re: BUG #5478: ILIKE operator returns wrong result
Previous Message Bruce Momjian 2010-05-28 15:38:29 Re: BUG #5478: ILIKE operator returns wrong result