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

From Andrew Dunstan
Subject Re: like/ilike improvements
Date
Msg-id 465370A4.7060701@dunslane.net
Whole thread Raw
In response to Re: like/ilike improvements  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers

Tom Lane wrote:
> Yeah.  It seems we need three comparison functions after all:
>   

Yeah, that was my confusion. I thought we had concluded that we didn't, 
but clearly we do.

> 1. Single-byte character set: needs NextByte and ByteEq only.
>
> 2. Generic multi-byte character set: both % and _ must advance by
> characters to ensure we never try an out-of-alignment character
> comparison.  But simple character comparison works bytewise given
> that.  So primitives are NextChar, NextByte, ByteEq.
>
> 3. UTF8: % can advance bytewise.  _ must check it is on a first byte
> (else return match failure) and if so do NextChar.  So primitives
> are NextChar, NextByte, ByteEq, IsFirstByte.
>
> In no case do we need CharEq.  I'd be inclined to drop ByteEq as a
> macro and just use "==", too.
>
>     
>   

I'll work this up. I think it will be easier if I marry cases 1 and 2, 
with NextChar being the same as NextByte in the single byte case.

cheers

andrew



pgsql-hackers by date:

Previous
From: mark@mark.mielke.cc
Date:
Subject: Re: like/ilike improvements
Next
From: "Andrej Ricnik-Bay"
Date:
Subject: Re: Re: [Oledb-dev] double precision error with pg linux server, but not with windows pg server