Re: Allow multi-byte characters as escape in SIMILAR TO and SUBSTRING - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Allow multi-byte characters as escape in SIMILAR TO and SUBSTRING
Date
Msg-id 9045.1405093870@sss.pgh.pa.us
Whole thread Raw
In response to Allow multi-byte characters as escape in SIMILAR TO and SUBSTRING  (Jeff Davis <pgsql@j-davis.com>)
Responses Re: Allow multi-byte characters as escape in SIMILAR TO and SUBSTRING  (Jeff Davis <pgsql@j-davis.com>)
List pgsql-hackers
Jeff Davis <pgsql@j-davis.com> writes:
> Attached is a small patch to $SUBJECT.
> In master, only single-byte characters are allowed as an escape. Of
> course, with the patch it must still be a single character, but it may
> be multi-byte.

I'm concerned about the performance cost of this patch.  Have you done
any measurements about what kind of overhead you are putting on the
inner loop of similar_escape?

At the very least, please don't call GetDatabaseEncoding() over again
every single time through the inner loop.  More generally, why do we
need to use pg_encoding_verifymb?  The input data is presumably validly
encoded.  ISTM the significantly cheaper pg_mblen() would be more
appropriate.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Jeff Davis
Date:
Subject: Re: Allow multi-byte characters as escape in SIMILAR TO and SUBSTRING
Next
From: Michael Banck
Date:
Subject: Re: Is there a way to temporarily disable a index