FS#16481 - Bad defaults: PostgreSQL defaults to C locale because Arch overrides LC_COLLATE

Attached to Project: Arch Linux
Opened by Marti (intgr) - Tuesday, 06 October 2009, 13:33 GMT
Last edited by Roman Kyrylych (Romashka) - Tuesday, 06 October 2009, 13:44 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To No-one
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description:
On most distributions, PostgreSQL defaults to UTF-8 encoding, as they have the LOCALE or LANG environment variable set with an UTF-8 locale. Most users expect recent database engines to "just work" with Unicode data without any special configuration.

On Arch Linux, however, even if the user has LOCALE=en_US.UTF-8 set in their rc.conf, PostgreSQL gets initialized with a C locale because it relies on LC_COLLATE. Arch's default /etc/profile overrides LC_COLLATE=C

Personally I think this is a good override, but it just doesn't play nice with PostgreSQL. Thus I suggest changing initdb in /etc/rc.d/postgresql to use the user's preferred LOCALE:
- su - postgres -c "/usr/bin/initdb -D $PGROOT/data"
+ su - postgres -c "/usr/bin/initdb -D $PGROOT/data --locale $LOCALE"

(See also: related bug  FS#12432  to specify initdb options from /etc/conf.d)



Steps to reproduce:
# grep ^LOCALE /etc/rc.conf
LOCALE="en_US.UTF-8"
# grep ^LC_COLLATE /etc/profile
LC_COLLATE="C"
# pacman -S postgresql
...
# /etc/rc.d/postgresql start
:: Starting PostgreSQL [BUSY]
...
The database cluster will be initialized with locale C.
The default database encoding has accordingly been set to SQL_ASCII.
...
This task depends upon

Closed by  Roman Kyrylych (Romashka)
Tuesday, 06 October 2009, 13:44 GMT
Reason for closing:  Won't fix
Additional comments about closing:  the proposed fix is obsoleted by a proper fix
Comment by Roman Kyrylych (Romashka) - Tuesday, 06 October 2009, 13:43 GMT
This is already fixed in SVN in a better way - LC_COLLATE won't be overrided with the next version of the 'filesystem' package. See  FS#15250 .

Loading...