Re: [HACKERS] locales and encodings Oh MY!

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: mark <dvlhntr(at)gmail(dot)com>, Gabriele Bartolini <gabriele(dot)bartolini(at)2ndquadrant(dot)it>, pgsql-admin(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] locales and encodings Oh MY!
Date: 2010-11-12 19:03:53
Message-ID: 14524.1289588633@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> With how similar straight C and en_US.UTF8 are it was suggested to me,
>> by persons who are far more C knowledgeable then I in my office, that
>> this is something the PG community could "fix" . A "fix" being so that
>> "col LIKE 'foo%' " could use btree indexes in locales like en_US.UTF8
>> (and probably some others).

>> is the request unreasonable ? anyone got any idea of the price tag to
>> make that happen ?

> I thought it already did that.

No, and the odds of it ever happening are insignificant. The sort order
associated with en_US (and other "dictionary order" locales) is just too
randomly different from what you need to optimize a LIKE search.
(Whoever told you en_US sorts similarly to C is nuts.)

The solution if you want the database's prevailing sort order to be en_US
is to put an extra text_pattern_ops index on the column you want to do
LIKE searches on. We might eventually have the ability to spell that
"put a C-locale index on the column", but text_pattern_ops is the way to
do it today.

regards, tom lane

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message mark 2010-11-12 19:17:00 Re: [HACKERS] locales and encodings Oh MY!
Previous Message Robert Haas 2010-11-12 18:53:40 Re: [HACKERS] locales and encodings Oh MY!

Browse pgsql-hackers by date

  From Date Subject
Next Message mark 2010-11-12 19:17:00 Re: [HACKERS] locales and encodings Oh MY!
Previous Message Robert Haas 2010-11-12 18:58:24 Re: WIP: extensible enums