Re: [HACKERS] strcmp() tie-breaker for identical ICU-collated strings - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] strcmp() tie-breaker for identical ICU-collated strings
Date
Msg-id 19269.1496353697@sss.pgh.pa.us
Whole thread Raw
In response to Re: [HACKERS] strcmp() tie-breaker for identical ICU-collated strings  (Peter Geoghegan <pg@bowt.ie>)
List pgsql-hackers
Peter Geoghegan <pg@bowt.ie> writes:
> On Thu, Jun 1, 2017 at 2:24 PM, Thomas Munro
> <thomas.munro@enterprisedb.com> wrote:
>> Why should ICU be any different than the system provider in this
>> respect?  In both cases, we have a two-level comparison: first we use
>> the collation-aware comparison, and then as a tie breaker, we use a
>> binary comparison.  If we didn't do a binary comparison as a
>> tie-breaker, wouldn't the result be logically incompatible with the =
>> operator, which does a binary comparison?

> I agree with that assessment.

The critical reason why this is not optional is that if texteq were to
return true for strings that aren't bitwise identical, that breaks hashing
--- unless you can guarantee that the hash values for such strings will be
equal anyway.  That's hardly possible when we don't even know what the
collation's comparison rule is, and would likely be difficult even if
we had complete knowledge.

So no, we're not going there for ICU any more than we did for libc.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Joe Conway
Date:
Subject: Re: [HACKERS] Hash Functions
Next
From: Thomas Munro
Date:
Subject: Re: [HACKERS] strcmp() tie-breaker for identical ICU-collated strings