Skip site navigation (1) Skip section navigation (2)

Re: UTF8MatchText

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, pgsql-patches(at)postgresql(dot)org
Subject: Re: UTF8MatchText
Date: 2007-05-17 16:56:55
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-patches
I wrote:
> ISTM we should generate all these match functions from one body of 
> code plus some #define magic.
> As I understand it, we have three possible encoding switches:  Single 
> Byte, UTF8 and other Multi Byte Charsets, and two possible case 
> settings: case Sensitive and Case Insensitive. That would make for a 
> total of six functions, but in the case of both UTF8 and other MBCS we 
> don't need a special Case Insensitive function - instead we downcase 
> both the string and the pattern and then use the Case Sensitive 
> function. That leaves a total of four functions.
> What is not clear to me is why the UTF8 optimisation work, and why it 
> doesn't apply to other MBCS. At the very least we need a comment on that.
> I also find the existing function naming convention somewhat annoying 
> - having foo() and MB_foo() is less than clear. I'd rather have 
> SB_foo() and MB_foo(). That's not your fault, of course.
> If you supply me with some explanation on the UTF8 optimisation issue, 
> I'll prepare a revised patch along these lines.

Ok, I have studied some more and I think I understand what's going on. 
AIUI, we are switching from some expensive char-wise comparisons to 
cheap byte-wise comparisons in the UTF8 case because we know that in 
UTF8 the magic characters ('_', '%' and '\') aren't a part of any other 
character sequence. Is that putting it too mildly? Do we need stronger 
conditions than that? If it's correct, are there other MBCS for which 
this is true?



In response to


pgsql-hackers by date

Next:From: Andrew DunstanDate: 2007-05-17 17:03:54
Subject: Re: mb and ecpg regression tests
Previous:From: Tom LaneDate: 2007-05-17 16:40:30
Subject: Re: mb and ecpg regression tests

pgsql-patches by date

Next:From: Heikki LinnakangasDate: 2007-05-17 17:02:44
Subject: Re: Diagnostic functions
Previous:From: Heikki LinnakangasDate: 2007-05-17 16:32:05
Subject: Seq scans status update

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group