Re: sorting/comparing column values in non-alphanumeric sorting ways ?

Поиск
Список
Период
Сортировка
От Peter Geoghegan
Тема Re: sorting/comparing column values in non-alphanumeric sorting ways ?
Дата
Msg-id CAH2-WzmvqV-u6X1LoX2V=qVhCx7Xr9mVYo0qjZcE_GkJpJgA-A@mail.gmail.com
обсуждение исходный текст
Ответ на sorting/comparing column values in non-alphanumeric sorting ways ?  (David Gauthier <davegauthierpg@gmail.com>)
Список pgsql-general
On Wed, Jul 11, 2018 at 2:44 PM, David Gauthier
<davegauthierpg@gmail.com> wrote:
> I want to load the 'highestver' column with the highest version of tcfg1-3.
>
> This won't work...
> update tv set greatest = greatest(tcfg1,tcfg2,tcfg3)
> ...because it thinks 1.0.9 is greater than 1.0.10
>
> Is there a way to get this to work right ?

If you're using v10 with ICU, then you can create a custom ICU
collation for this, with "natural" sort order. Something like this
should work:

CREATE COLLATION numeric (provider = icu, locale = 'en-u-kn-true');

See the docs -- "23.2.2.3.2. ICU collations".

-- 
Peter Geoghegan


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

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: sorting/comparing column values in non-alphanumeric sorting ways ?
Следующее
От: Tim Cross
Дата:
Сообщение: Re: Open Source tool to deploy/promote PostgreSQL DDL