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:34:52 |
Message-ID: | 26124.1275060892@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:
>> I have a feeling that this represents still another bug in the
>> special-case path for % followed by _ (cf bug #4821). If so,
>> maybe we ought to just toss out that optimization?
> Yea, looks like it is this code in like_match.c:
No, actually it's the bit right after that:
/* Look for a place that matches the rest of the pattern */
while (tlen > 0)
{
int matched = MatchText(t, tlen, p, plen);
if (matched != LIKE_FALSE)
return matched; /* TRUE or ABORT */
NextChar(t, tlen);
}
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.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2010-05-28 15:38:29 | Re: BUG #5478: ILIKE operator returns wrong result |
Previous Message | Bruce Momjian | 2010-05-28 14:55:26 | Re: BUG #5478: ILIKE operator returns wrong result |