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

From Tom Lane
Subject Re: like/ilike improvements
Date
Msg-id 13135.1180027067@sss.pgh.pa.us
Whole thread Raw
In response to Re: like/ilike improvements  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: like/ilike improvements
Re: like/ilike improvements
List pgsql-hackers
Andrew Dunstan <andrew@dunslane.net> writes:
> OK, Here is a patch that I am fairly confident does what's been 
> discussed, as summarised by Tom.

> ! #define CHAREQ(p1, p2) (*p1 == *p2)
> ...
> + #define IsFirstByte(c) ((*c & 0xC0) != 0x80)

These macros are bugs waiting to happen.  Please parenthesize the
arguments.

The header comment for like_match.c needs more love:
* This file is included by like.c *twice*, to provide an optimization* for single-byte encodings.

I'm not sure I believe the new coding for %-matching at all, and I
certainly don't like the 100% lack of comments explaining why the
different cases are necessary and just how they differ.  In particular,
once we've advanced more than one character, why does it still matter
what was immediately after the %?

There should somewhere be a block comment explaining all the reasoning
we've so painfully gone through about why the three cases (SB, MB, UTF8)
are needed and how they must differ.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Help Required regarding implementing operators in postgreSQL
Next
From: Andrew Dunstan
Date:
Subject: Re: like/ilike improvements