Re: [Review] Tests citext casts by David Wheeler.

Поиск
Список
Период
Сортировка
От David E. Wheeler
Тема Re: [Review] Tests citext casts by David Wheeler.
Дата
Msg-id 981AF544-4983-4C2F-A329-E751D475EAAD@kineticode.com
обсуждение исходный текст
Ответ на Re: [Review] Tests citext casts by David Wheeler.  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: [Review] Tests citext casts by David Wheeler.
Список pgsql-hackers
On Sep 5, 2008, at 11:30, Tom Lane wrote:

> Thanks for reviewing.  I've committed this with your suggestions and
> one additional non-cosmetic change: schema-qualify names in the
> bodies of the SQL functions so that they are not search_path  
> dependent.

Thanks, I'll check that out.

> One thing that didn't make a lot of sense to me was the last new
> function:
>
> CREATE OR REPLACE FUNCTION translate( citext, citext, text ) RETURNS  
> TEXT AS $$
>    SELECT  
> pg_catalog.translate( pg_catalog.translate( $1::pg_catalog.text,  
> pg_catalog.lower($2::pg_catalog.text), $3),  
> pg_catalog.upper($2::pg_catalog.text), $3);
> $$ LANGUAGE SQL IMMUTABLE STRICT;
>
> Why is it using upper()?

To make translate() work case-insensitively, it does two translates:  
One lowercase and one uppercase. This allows the translated value to  
be returned with its original casing in tact. No, this isn't ideal,  
but it was simple to do.

Best,

David



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

Предыдущее
От: Heikki Linnakangas
Дата:
Сообщение: Re: Prototype: In-place upgrade v02
Следующее
От: Jeff Davis
Дата:
Сообщение: Re: Planner question