Re: Bug in ILIKE? - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: Bug in ILIKE?
Date
Msg-id 48DD6571.30406@dunslane.net
Whole thread Raw
In response to Re: Bug in ILIKE?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Bug in ILIKE?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers

Tom Lane wrote:
> I think it's just a bug in 8.3.
>
>
>

Well, here's a patch that I think fixes it. If you're happy I'll apply
it to HEAD and 8.3.

cheers

andrew
? .deps
Index: like_match.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/utils/adt/like_match.c,v
retrieving revision 1.21
diff -c -r1.21 like_match.c
*** like_match.c    1 Mar 2008 03:26:34 -0000    1.21
--- like_match.c    26 Sep 2008 22:38:26 -0000
***************
*** 96,105 ****
      {
          if (*p == '\\')
          {
!             /* Next byte must match literally, whatever it is */
              NextByte(p, plen);
!             if ((plen <= 0) || *p != *t)
                  return LIKE_FALSE;
          }
          else if (*p == '%')
          {
--- 96,108 ----
      {
          if (*p == '\\')
          {
!             /* Next char must match literally, whatever it is */
              NextByte(p, plen);
!             if ((plen <= 0) || TCHAR(*p) != TCHAR(*t))
                  return LIKE_FALSE;
+             NextChar(t,tlen);
+             NextChar(p,plen);
+             continue;
          }
          else if (*p == '%')
          {

pgsql-hackers by date:

Previous
From: Chris Browne
Date:
Subject: Re: PostgreSQL future ideas
Next
From: Tom Lane
Date:
Subject: Re: Bug in ILIKE?