Re: [HACKERS] Bug in LIKE ? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] Bug in LIKE ?
Date
Msg-id 23773.928763047@sss.pgh.pa.us
Whole thread Raw
In response to Re: [HACKERS] Bug in LIKE ?  (Daniele Orlandi <daniele@orlandi.com>)
Responses Re: [HACKERS] Bug in LIKE ?
Re: [HACKERS] Bug in LIKE ?
List pgsql-hackers
Daniele Orlandi <daniele@orlandi.com> writes:
> Uhm.... I think the problem is a little worse:

It's a real bug, and I see the problem: someone changed the handling of
LIKE prefixes in gram.y, without understanding quite what they were
doing.  6.4.2 has:
                if (n->val.val.str[pos] == '\\' ||                    n->val.val.str[pos] == '%')
pos++;

where 6.5 has:
                if (n->val.val.str[pos] == '\\' ||                    n->val.val.str[pos+1] == '%')
pos++;

The first one is right and the second is not.

Unless we fix this, LIKE will be completely busted for any string
containing non-leading %.  Shall I ... ?
        regards, tom lane


pgsql-hackers by date:

Previous
From: The Hermit Hacker
Date:
Subject: Re: [HACKERS] postgresql-v6.5beta2.tar.gz ...
Next
From: The Hermit Hacker
Date:
Subject: Re: [HACKERS] Bug in LIKE ?