Re: PATCH: CITEXT 2.0

From: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Gregory Stark <stark(at)enterprisedb(dot)com>, pgsql-hackers(at)postgresql(dot)org, "Zdenek Kotala" <Zdenek(dot)Kotala(at)Sun(dot)COM>, "Alvaro Herrera" <alvherre(at)commandprompt(dot)com>
Subject: Re: PATCH: CITEXT 2.0
Date: 2008-07-08 00:03:34
Message-ID: 1D9FF20F-FFBF-4584-B6F0-D33B54B9E2CB@kineticode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Jul 7, 2008, at 16:58, Tom Lane wrote:

> "David E. Wheeler" <david(at)kineticode(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen R. van den Berg 2008-07-08 00:05:35 Data type OID numbers fixed?
Previous Message Tom Lane 2008-07-07 23:58:07 Re: PATCH: CITEXT 2.0