Re: like/ilike improvements

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: andrew(at)supernews(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: like/ilike improvements
Date: 2007-05-24 17:17:47
Message-ID: 13135.1180027067@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Andrew Dunstan <andrew(at)dunslane(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2007-05-24 18:02:35 Re: like/ilike improvements
Previous Message Tom Lane 2007-05-24 15:37:33 Re: Help Required regarding implementing operators in postgreSQL

Browse pgsql-patches by date

  From Date Subject
Next Message Andrew Dunstan 2007-05-24 18:02:35 Re: like/ilike improvements
Previous Message Tom Lane 2007-05-24 05:16:34 Re: Concurrent psql patch