Re: like/ilike improvements - Mailing list pgsql-hackers

From Tom Lane
Subject Re: like/ilike improvements
Date
Msg-id 14707.1179853274@sss.pgh.pa.us
Whole thread Raw
In response to Re: like/ilike improvements  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-hackers
Andrew Dunstan <andrew@dunslane.net> writes:
> Tom Lane wrote:
>> I thought we'd determined that advancing bytewise for "%" was also 
>> risky, in two cases:
>> 
>> 1. Multibyte character set that is not UTF8 (more specifically, does not
>> have a guarantee that first bytes and not-first bytes are distinct)

> I thought we disposed of the idea that there was a problem with charsets 
> that didn't do first byte special.

We disposed of that in connection with a version of the patch that had
"%" advancing in NextChar units, so that comparison of ordinary
characters was always safely char-aligned.  Consider 2-byte characters
represented as {AB} etc:
DATA    x{AB}{CD}y
PATTERN    %{BC}%

If "%" advances by bytes then this will find a spurious match.  The
only thing that prevents it is if "B" can't be both a leading and a
trailing byte of validly-encoded MB characters.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: Re: [Oledb-dev] double precision error with pg linux server, but not with windows pg server
Next
From: Tom Lane
Date:
Subject: Re: Re: [Oledb-dev] double precision error with pg linux server, but not with windows pg server