Non-C locale and LIKE - Mailing list pgsql-hackers

From Bruce Momjian
Subject Non-C locale and LIKE
Date
Msg-id 200411280452.iAS4quv12028@candle.pha.pa.us
Whole thread Raw
Responses Re: Non-C locale and LIKE  (Tatsuo Ishii <t-ishii@sra.co.jp>)
Re: Non-C locale and LIKE  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
I know we can't currently use an index with non-C locales and LIKE
except when we create a sepcial type of index for LIKE indexing
(text_pattern_ops).

However, I am wondering if we should create a character lookup during
initdb that has the characters ordered so we can do:
col LIKE 'ha%' AND col >= "ha" and col <= "hb"

Could we do this easily for single-character encodings?  We could have:
A    1B    2C    3

and a non-C locale could be:
A    1A`    2B    3

We can't handle multi-byte encodings because the number of combinations
is too large or not known.

Also, we mention you should use the "C" locale to use normal indexes for
LIKE but isn't it more correct to say the encoding has to be SQL_ASCII?

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: psql and schemas
Next
From: "John Hansen"
Date:
Subject: Re: Non-C locale and LIKE