From: | Iain Barnett <iainspeed(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Locale and UTF8 for template1 in 8.4.4 |
Date: | 2011-05-06 15:11:52 |
Message-ID: | 1DBD55F6-FA8B-4974-982F-75CCB207471F@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi,
I'd like to change the template1 database to be in UTF8 and en_GB, so that all databases I create (unless specified otherwise) will start with that encoding by default, if I understand correctly. I've searched around for how to do this but can't seem to get what I've found to work.
If I run `locale` at the command-line, this is the output:
LANG=
LC_COLLATE="C"
LC_CTYPE="C"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=
I copied the template1 create table statement from the pgadmin gui, and change it from this:
CREATE DATABASE template1
WITH OWNER = _postgres
ENCODING = 'SQL_ASCII'
TABLESPACE = pg_default
LC_COLLATE = 'C'
LC_CTYPE = 'C'
CONNECTION LIMIT = -1;
GRANT CONNECT ON DATABASE template1 TO public;
GRANT ALL ON DATABASE template1 TO _postgres;
COMMENT ON DATABASE template1 IS 'default template database';
to this:
CREATE DATABASE template1
WITH OWNER = _postgres
ENCODING = 'UTF8'
TABLESPACE = pg_default
LC_COLLATE = 'en_GB.UTF8'
LC_CTYPE = 'en_GB.UTF8'
CONNECTION LIMIT = -1;
GRANT CONNECT ON DATABASE template1 TO public;
GRANT ALL ON DATABASE template1 TO _postgres;
COMMENT ON DATABASE template1 IS 'default template database';
but when I run it the output has these errors:
ERROR: cannot drop a template database
STATEMENT: DROP DATABASE template1;
psql:/Volumes/RubyProjects/template1.sql:2: ERROR: cannot drop a template database
ERROR: invalid locale name en_GB.UTF8
<snip>
Ok, so I can't change the template1 database that way, but I'm concerned that it says the locale name is invalid. I got the list of locales from here http://www.postgresql.org/docs/8.4/static/multibyte.html
Would anyone be able to point out to me how I can get the template1 database to be utf8 and en_GB? (or US, I'm not *that* fussed)
I'm running postgres version 8.4.4
Any help is greatly appreciated.
Regards,
Iain
From | Date | Subject | |
---|---|---|---|
Next Message | Daniele Varrazzo | 2011-05-06 15:12:01 | psql and query buffer mangling |
Previous Message | Jens Wilke | 2011-05-06 15:01:05 | Re: undead index |