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

From David E. Wheeler
Subject Re: PATCH: CITEXT 2.0
Date
Msg-id 1D9FF20F-FFBF-4584-B6F0-D33B54B9E2CB@kineticode.com
Whole thread Raw
In response to Re: PATCH: CITEXT 2.0  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: PATCH: CITEXT 2.0
List pgsql-hackers
On Jul 7, 2008, at 16:58, Tom Lane wrote:

> "David E. Wheeler" <david@kineticode.com> writes:
>> Hrm. So in your opinion, strncmp() could be used for all comparisons
>> by citext, rather than varstr_cmp()?
>
> I thought the charter of this type was to work like lower(textcol).

Correct.

> If that's so, you certainly can't use strncmp, because that would  
> result
> in sort orderings totally different from lower()'s result.  Even  
> without
> that argument, for most multibyte cases you'd get a pretty arbitrary,
> user-unfriendly sort ordering.

Now I'm confused again. :-( Whether or not I use strncmp() or  
varstr_cmp(), I first lowercase the value to be compared using  
str_tolower(). What Zdenek has said is, that aside, just as for the  
TEXT type, I should use strncmp() for = and <>, and varstr_cmp() for  
everything else. Are you saying something different?

I could use some examples to play with in order to ensure that things  
are behaving as they should. I'll add regression tests for them.

Thanks,

David



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: PATCH: CITEXT 2.0
Next
From: "Stephen R. van den Berg"
Date:
Subject: Data type OID numbers fixed?