View previous topic :: View next topic |
Author |
Message |
gorkha n00b
Joined: 15 Oct 2004 Posts: 44
|
Posted: Thu Feb 27, 2014 12:39 am Post subject: Setting up postgresql 9.3 |
|
|
I tried:
emerge --config dev-db/postgresql-server:9.3
but I get:
Code: |
* Checking system parameters...
* Checking whether your system supports at least 128 connections...
* Passed.
* Creating the data directory ...
* Initializing the database ...
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.utf8".
initdb: "da_DK.UTF8" is not a valid server encoding name
mv: cannot stat '/var/lib/postgresql/9.3/data/*.conf': No such file or directory
|
I am not exactly sure what I am missing but it has to be able to recognise Danish letters upper and lower case
I don't want any messages in Danish though
What can I do to get the database initialized properly? |
|
Back to top |
|
|
baaann Guru
Joined: 23 Jan 2006 Posts: 558 Location: uk
|
|
Back to top |
|
|
limn l33t
Joined: 13 May 2005 Posts: 997
|
Posted: Thu Feb 27, 2014 2:25 pm Post subject: |
|
|
You should have what you want. Messages will be in US English. By default, postgresql uses UTF8.
Code: | # \encoding
UTF8
# create table test (danish text);
CREATE TABLE
# insert into test values ('Hvad så?');
INSERT 0 1
# select * from test;
danish
----------
Hvad så?
(1 row)
|
|
|
Back to top |
|
|
gorkha n00b
Joined: 15 Oct 2004 Posts: 44
|
Posted: Thu Feb 27, 2014 3:54 pm Post subject: |
|
|
Except that my problem is that emerge --config fails as shown in above code block - The data directory is completely empty |
|
Back to top |
|
|
baaann Guru
Joined: 23 Jan 2006 Posts: 558 Location: uk
|
Posted: Thu Feb 27, 2014 4:43 pm Post subject: |
|
|
From the error message, I would think the problem is with your locale? Is the Danish locale included in your system? Taken from the wiki page
Quote: | A complete list of language and character encodings supported by the server can be found in the documentation, but your system must also support the respective languages and character encodings. Compare the output of locale -a to the encodings in the documentation. |
|
|
Back to top |
|
|
limn l33t
Joined: 13 May 2005 Posts: 997
|
Posted: Thu Feb 27, 2014 4:53 pm Post subject: |
|
|
What shows
and
Code: | grep -v ^# /etc/locale.gen |
Did you change the postgresql config file?
I changed my locale to da_DK.UTF-8 on a test box and postgresql created the DB.
Code: | The database cluster will be initialized with locale "da_DK.UTF-8". |
|
|
Back to top |
|
|
gorkha n00b
Joined: 15 Oct 2004 Posts: 44
|
Posted: Thu Feb 27, 2014 5:58 pm Post subject: |
|
|
Code: |
# locale
LANG=en_US.utf8
LC_CTYPE="en_US.utf8"
LC_NUMERIC="en_US.utf8"
LC_TIME="en_US.utf8"
LC_COLLATE="en_US.utf8"
LC_MONETARY="en_US.utf8"
LC_MESSAGES="en_US.utf8"
LC_PAPER="en_US.utf8"
LC_NAME="en_US.utf8"
LC_ADDRESS="en_US.utf8"
LC_TELEPHONE="en_US.utf8"
LC_MEASUREMENT="en_US.utf8"
LC_IDENTIFICATION="en_US.utf8"
LC_ALL=
# grep -v ^# /etc/locale.gen
da_DK UTF-8
da_DK ISO-8859-1
en_US UTF-8
en_US ISO-8859-1
|
Some places it's utf8 without the dash, other places it is utf-8 and different cases too, does that have any importance? |
|
Back to top |
|
|
limn l33t
Joined: 13 May 2005 Posts: 997
|
Posted: Thu Feb 27, 2014 6:46 pm Post subject: |
|
|
Working with locales can be confusing. I think your system added .utf8. Could be artifact from before some committee said, uppercase, with dash.
/usr/share/i18n/SUPPORTED has supported locales. See top of /etc/locale.gen file. Try changing in /etc/locale.gen
Code: | da_DK UTF-8
en_US UTF-8
|
to
Code: |
en_US.UTF-8 UTF-8
da_DK.UTF-8 UTF-8
|
Then run locale-gen. Log out and back in to pick up change, and try creating DB. |
|
Back to top |
|
|
gorkha n00b
Joined: 15 Oct 2004 Posts: 44
|
Posted: Thu Feb 27, 2014 7:22 pm Post subject: |
|
|
yes, thanks.
I figured out the rest I think. At least it now initialized with the settings:
PG_INITDB_OPTS="--encoding=UTF-8 --locale=da_DK.UTF-8 --lc-messages=en_US.UTF-8" |
|
Back to top |
|
|
|