Re: PATCH: CITEXT 2.0 - Mailing list pgsql-hackers

From David E. Wheeler
Subject Re: PATCH: CITEXT 2.0
Date
Msg-id 2679EDDF-7BAB-465B-866A-7B94C6975306@kineticode.com
Whole thread Raw
In response to Re: PATCH: CITEXT 2.0  (Zdenek Kotala <Zdenek.Kotala@Sun.COM>)
Responses Re: PATCH: CITEXT 2.0  ("David E. Wheeler" <david@kineticode.com>)
List pgsql-hackers
On Jul 7, 2008, at 12:13, Zdenek Kotala wrote:

> I'm sorry. I meant bttext() http://doxygen.postgresql.org/varlena_8c-source.html#l01270
>
> bttext should use in citextcmp function. It uses strcol function.

I've no idea what bttext has to do with anything. Sorry if I'm being  
slow here.

> And citext_eq should be implemented as texteq:
>
> http://doxygen.postgresql.org/varlena_8c-source.html#l01164
>
>     I'm sorry for confusion I'm exchange bttext and varstr_cmp. :(

Okay, I see that text_cmp() uses varstr_cmp():
  http://doxygen.postgresql.org/varlena_8c-source.html#l01139

While texteq() and textne() use strncmp():
  http://doxygen.postgresql.org/varlena_8c-source.html#l01164
http://doxygen.postgresql.org/varlena_8c-source.html#l01187

The other operator functions, like text_lt(), use text_cmp() and  
therefore varstr_cmp():
  http://doxygen.postgresql.org/varlena_8c-source.html#01210

My question is: why? Shouldn't they all use the same function for  
comparison? I'm happy to dupe this implementation for citext, but I  
don't understand it. Should not all comparisons be executed  
consistently?

Thanks,

David


pgsql-hackers by date:

Previous
From: Zdenek Kotala
Date:
Subject: Re: PATCH: CITEXT 2.0
Next
From: "David E. Wheeler"
Date:
Subject: Re: PATCH: CITEXT 2.0 v2