Re: default locale considered harmful? (was Re: [GENERAL] - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: default locale considered harmful? (was Re: [GENERAL]
Date
Msg-id Pine.LNX.4.44.0304201725360.2891-100000@peter.localdomain
Whole thread Raw
In response to default locale considered harmful? (was Re: [GENERAL] Using index for "like 'ABC%'" type query)  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: default locale considered harmful? (was Re: [GENERAL]
List pgsql-hackers
Tom Lane writes:

> I recall someone floating a proposal that initdb should by default
> initialize the database in C locale, not whatever-it-finds-in-the-
> environment.  To get a non-C locale you'd have to give an explicit
> command-line switch --- essentially, reversing the sense of the present
> "initdb --no-locale" option.

If you're concerned about speed, let's think about fixing the real
problems, not about disabling the feature altogether.  A while ago I
proposed an easy solution that made LIKE use an index based on strxfrm
order instead.  It was rejected on the grounds that it would prevent a
future enhancement of the LIKE mechanism to use the locale-enabled
collation order, but no one seems to be seriously interested in
implementing that.  I still have the patch; we can reconsider it if you
like.

(Btw., LIKE using the locale-enabled collation sequence is hardly going to
work, because most locales compare strings backwards from the end to the
start in the second pass, so something like LIKE 'foo%' can easily give
inconsistent results, since you don't know what the end of the string
really is.  It's better to think of pattern matching as
character-by-character matching.)

-- 
Peter Eisentraut   peter_e@gmx.net



pgsql-hackers by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: [PERFORM] Foreign key performance
Next
From: Peter Eisentraut
Date:
Subject: Re: rename/unlink handling for Win32