Re: like/ilike improvements

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Zeugswetter Andreas ADI SD <ZeugswetterA(at)spardat(dot)at>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, andrew(at)supernews(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: like/ilike improvements
Date: 2007-05-25 10:55:32
Message-ID: 4656C0A4.1040500@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Zeugswetter Andreas ADI SD wrote:
>
>> You have to be on a first byte before you can meaningfully
>> apply NextChar, and you have to use NextChar or else you
>> don't count characters correctly (eg "__" must match 2 chars
>> not 2 bytes).
>>
>
> Well, for utf8 NextChar could advance to the next char even if the
> current byte
> position is in the middle of a multibyte char (skip over all 10xxxxxx).
>
>
>

It doesn't matter - we are satisfied that it won't happen. However, this
might well be a useful optimisation of NextChar() for the UTF8 case as
something like

do { (t)++; (tlen)--} while ((*(t) & 0xC0) == 0x80 && tlen > 0)

In fact, I'm wondering if that might make the other UTF8 stuff redundant
- the whole point of what we're doing is to avoid expensive calls to
NextChar;

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2007-05-25 11:11:32 Re: like/ilike improvements
Previous Message Jaime Casanova 2007-05-25 10:49:29 Re: Reviewing temp_tablespaces GUC patch

Browse pgsql-patches by date

  From Date Subject
Next Message Andrew Dunstan 2007-05-25 11:11:32 Re: like/ilike improvements
Previous Message Zeugswetter Andreas ADI SD 2007-05-25 08:16:59 Re: like/ilike improvements