Re: PATCH: CITEXT 2.0

Поиск
Список
Период
Сортировка
От David E. Wheeler
Тема Re: PATCH: CITEXT 2.0
Дата
Msg-id C563AF78-6F19-4791-A4FB-44D8C047B16F@kineticode.com
обсуждение исходный текст
Ответ на Re: PATCH: CITEXT 2.0  (Alvaro Herrera <alvherre@commandprompt.com>)
Ответы Re: PATCH: CITEXT 2.0  (Gregory Stark <stark@enterprisedb.com>)
Список pgsql-hackers
On Jul 3, 2008, at 09:53, Alvaro Herrera wrote:

>> Thanks. What would citext_hash() look like? I don't see a  
>> text_hash() to
>> borrow from anywhere in src/.
>
> See hash_any().  I assume the difficulty is making sure that
> hash("FOO") = hash("foo") ...

Great, big help, thank you. So does this look sensible?

Datum
citext_hash(PG_FUNCTION_ARGS)
{    char       *txt;    char       *str;    Datum       result;
    txt = cilower( PG_GETARG_TEXT_PP(0) );    str = VARDATA_ANY(txt);
    result = hash_any((unsigned char *) str, VARSIZE_ANY_EXHDR(txt));
    /* Avoid leaking memory for toasted inputs */    PG_FREE_IF_COPY(txt, 0);    pfree( str );
    return result;
}

And how might I be able to test that it actually works?

Best,

David


В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Heikki Linnakangas"
Дата:
Сообщение: Re: gsoc, text search selectivity and dllist enhancments
Следующее
От: "David E. Wheeler"
Дата:
Сообщение: Re: PATCH: CITEXT 2.0