On 5/16/17 03:19, Ashutosh Bapat wrote:
> On Tue, May 16, 2017 at 10:03 AM, amul sul <sulamul@gmail.com> wrote:
>> On Mon, May 15, 2017 at 9:13 PM, Robert Haas <robertmhaas@gmail.com> wrote:
>>>>> Collation is only relevant for ordering, not equality.
>
> While earlier, I thought the same, I am wondering whether this is
> true. Don't different collations deem different strings equal e.g one
> collation may deem 'aa' and 'AA' as same but other may not. Or is that
> encoding problem being discussed in hash functions thread?
The collations we currently support don't do that, unless someone made a
custom one. However, we might want to support that in the future.
Also, text/varchar comparisons always use strcmp() as a tie-breaker.
Again, this might be something to review at some point.
But you currently have the citext type that would indeed consider 'aa'
and 'AA' equal. But citext also has a hash function in the hash
operator class that handles that. So you could look into using that
approach.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services