Re: lc_collate issue

Поиск
Список
Период
Сортировка
От db@zigo.dhs.org
Тема Re: lc_collate issue
Дата
Msg-id 1594.192.121.104.119.1188465343.squirrel@www.zigo.org
обсуждение исходный текст
Ответ на Re: lc_collate issue  (Cody Pisto <cpisto@rvweb.com>)
Список pgsql-general
> I'm just looking for the correct workaround.

While adding a new collation is the "correct" solution it's a lot of work.
Even then pg can't use different collations anyway unless you reinit
the datadir using initdb.

One workaround is to cast the text value into a bytea value, and then it
will be sorted in byte order no matter what locale you have. Like this:

  SELECT *
    FROM foo
ORDER BY CAST (some_column AS BYTEA);

This work except that there is no cast from text to bytea. But we can add
one using:

  CREATE CAST (text AS bytea) WITHOUT FUNCTION AS ASSIGNMENT;

I can't promise that WITHOUT FUNCTION will always work but currently bytea
and text values are stored in the same way so it should work (and it
probably will in future versions as well).

/Dennis



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

Предыдущее
От: Denis Gasparin
Дата:
Сообщение: Autovacuum not vacuuming pg_largeobject
Следующее
От: rafikoko
Дата:
Сообщение: Re: pg_dump.... pg_restore...how long does it take?