LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 07-26-2013, 08:38 AM   #1
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
PostgreSQL Locale Problem Slackware 64 Stable


I need to create a data base in PostgreSQL:
Code:
createdb -U dspace -E UNICODE dspace
createdb: database creation failed: ERROR:  encoding "UTF8" does not match locale "en_US"
DETAIL:  The chosen LC_CTYPE setting requires encoding "LATIN1".
I have the system locale set
Code:
locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE=C
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
Trying
Code:
export LC_CTYPE="LATIN1"
didn't do diddly squat and neither has anything else I've fiddled with (in /etc/profile.d/lang.sh, I have
Code:
export LANG=en_US.UTF-8
and
export LC_COLLATE=C
defined, nothing else).

Anybody got any ideas how to get the PostgreSQL data base created with the required encoding?
 
Old 07-26-2013, 09:42 AM   #2
mfrias
LQ Newbie
 
Registered: Dec 2007
Posts: 15

Rep: Reputation: 7
Quote:
Originally Posted by tronayne View Post
...
Code:
export LANG=en_US.UTF-8
and
export LC_COLLATE=C
...
The error is in LC_LOCATE, initdb must be initialized with the correct LC_LOCATE. LC_LOCATE must be configured and be equal to the rest of the other variables.

http://www.postgresql.org/docs/9.2/s...multibyte.html
 
1 members found this post helpful.
Old 07-26-2013, 10:06 AM   #3
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Original Poster
Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
@mfrias, thank you for the reply. Just before I read it, I had figured out that the problem was that the system was installed with the Slackware default locale and that PostgreSQL had been installed and initialized with that locale (which is LANG=en_US, not LANG=en_US.UTF-8). OK, blow away everything in /var/lib/pgsql, re-initialize, createuser, createdb and all is well that ends.

Lesson learned: if you're going to need to use UNICODE (at least for PostgreSQL), define that at system set up.

Thank you again.
 
Old 07-26-2013, 03:32 PM   #4
torimus
Member
 
Registered: Apr 2013
Distribution: Slackware
Posts: 81

Rep: Reputation: Disabled
You need not to do it this way. You can simply pass proper parameters to create database command like
Code:
create database <your_db_name> encoding='UTF8' LC_COLLATE='<your_locale>.UTF-8' LC_CTYPE='<your_locale>.UTF-8' template template0;
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
locale: Cannot Set LC_ALL to default locale: No such file or directory. asym Linux - General 11 10-24-2018 05:54 PM
What is more stable: Slackware or Debian Stable ? Xeratul Slackware 100 11-14-2015 10:07 PM
[SOLVED] Postgresql 8.47.on Debian/ Gnu Squeeze-stable. Imporitng data Learnix Linux - Software 1 04-15-2011 07:05 PM
locale: Cannot set LC_ALL to default locale: Invalid argument GadgetWiz Mandriva 1 03-31-2006 11:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 10:55 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration