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


---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

              http://archives.postgresql.org

Reply via email to