Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines
Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.
REPEAT: Do NOT report bugs for outdated packages!
https://wiki.archlinux.org/title/Bug_reporting_guidelines
Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.
REPEAT: Do NOT report bugs for outdated packages!
FS#27222 - [postgresql] Default encoding doesn't honour $LOCALE (rc.conf) and fallback to SQL_ASCII
Attached to Project:
Arch Linux
Opened by Shanto (Shanto) - Tuesday, 22 November 2011, 04:08 GMT
Last edited by Dan McGee (toofishes) - Monday, 05 December 2011, 21:08 GMT
Opened by Shanto (Shanto) - Tuesday, 22 November 2011, 04:08 GMT
Last edited by Dan McGee (toofishes) - Monday, 05 December 2011, 21:08 GMT
|
DetailsProblem description:
-------------------- Unicode is the recommended default encoding for PostgreSQL. However, to get that in Arch, you have to go through these steps every time you install/upgrade: https://wiki.archlinux.org/index.php/PostgreSQL#Change_Default_Encoding_of_New_Databases_To_UTF-8_.28Optional.29 I think, this could be handled better with slight changes to the shipped conf.d file where it honours the $LOCALE set in rc.conf. Reproducing the problem: ------------------------ # do this with an empty postgresql data dir (/var/lib/postgres) $ sudo rc.d start postgresql The files belonging to this database system will be owned by user "postgres". This user must also own the server process. The database cluster will be initialized with locale *C*. The default database encoding has accordingly been set to *SQL_ASCII*. The default text search configuration will be set to "english". Possible fix (patch attached): ------------------------------ 1. Uncomment INITOPTS in http://projects.archlinux.org/svntogit/packages.git/tree/trunk/postgresql.confd?h=packages/postgresql 2. Instead of using $LANG, which is not a reliable source, use $LOCALE variable (derived from rc.conf by the corresponding rc.d script). After fixing: ------------- $ grep ^LOCALE= /etc/rc.conf LOCALE="en_US.UTF-8" $ sudo rc.d start postgresql The files belonging to this database system will be owned by user "postgres". This user must also own the server process. The database cluster will be initialized with locale *en_US.UTF-8*. The default database encoding has accordingly been set to *UTF8*. The default text search configuration will be set to "english". |
This task depends upon
Closed by Dan McGee (toofishes)
Monday, 05 December 2011, 21:08 GMT
Reason for closing: Fixed
Additional comments about closing: 9.1.2-1
Monday, 05 December 2011, 21:08 GMT
Reason for closing: Fixed
Additional comments about closing: 9.1.2-1
postgresql.confd.patch
This is not meant to be a one-size-fits-all package, you need to carefully set up the package as appropriate, and I purposely commented everything in the config file because running under different users gave you different results before, which is just plain unacceptable.
I could put a commented `INITOPTS="--locale en_US.UTF-8"` bit in the file, but we're not RH nor Ubuntu; there is some work to do around here.
Just in case you missed it, I talked about using $LOCALE from /etc/rc.conf (already sourced by the postgresql init script), not from your user environment. So, if you are fine with supplying uncommented/default "LOCALE=en_US.UTF-8" in rc.conf, you should be fine too with using that same default (intended for majority).
Otherwise, don't check for data directory (http://projects.archlinux.org/svntogit/packages.git/tree/trunk/postgresql?h=packages/postgresql#n16) and don't call initdb from within the init script. Stop there and let the user handle it entirely. If you initialize the db from there, do it properly or don't do at all.