Re: sortsupport for text - Mailing list pgsql-hackers

From Tom Lane
Subject Re: sortsupport for text
Date
Msg-id 2897.1339964793@sss.pgh.pa.us
Whole thread Raw
In response to Re: sortsupport for text  (Peter Geoghegan <peter@2ndquadrant.com>)
Responses Re: sortsupport for text  (Peter Geoghegan <peter@2ndquadrant.com>)
Re: sortsupport for text  (Greg Stark <stark@mit.edu>)
List pgsql-hackers
Peter Geoghegan <peter@2ndquadrant.com> writes:
> Right, most people won't care. You may or may not want a new
> Operator for equivalency. The regular operator for equality doesn't have to
> and shouldn't change. It is both useful and conceptually clean to not
> guarantee that a compator can be relied upon to indicate equality and not
> just equivalency.

Sure, and in general we only expect that "=" operators mean equivalency;
a concrete example is float8 "=", which on IEEE-spec machines will say
that zero and minus zero are equal.

The trick for hashing such datatypes is to be able to guarantee that
"equal" values hash to the same hash code, which is typically possible
as long as you know the equality rules well enough.  We could possibly
do that for text with pure-strcoll equality if we knew all the details
of what strcoll would consider "equal", but we do not.

See also citext for an example of a datatype where we can manage to
treat distinct textual values as equal and still hash them.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Josh Berkus
Date:
Subject: Re: Streaming-only Remastering
Next
From: Daniel Farina
Date:
Subject: Re: Streaming-only Remastering