Can't change LC_CTYPE/locale

From: "Schuhmacher, Bret" <Bret(dot)Schuhmacher(at)Aspect(dot)com>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: Can't change LC_CTYPE/locale
Date: 2005-02-03 15:28:37
Message-ID: 98E4F4D46DACD0479C96D7356D5C37356B040F@sac1exch3.aspect.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hello all - I know I reported everything was fine the other day on this,
but something strange happened...

My Linux box (Fedora Core 3) crashed and wouldn't reboot; the bios said
it couldn't find a hard drive and it was making horrible noises,
although the disk was 4 days old. I turned it off. 2 days later, on a
whim, I turned it back on and it booted fine. Possibly a heat related
issue...

I hadn't changed anything, but queries were failing with complaints
about multibyte characters (the same complaints that made me look into
LC_CTYPE earlier). I took a look at lc_ctype in postgres and it had
magically changed back to en_US.UTF-8!

I decided to drop and rebuild the db, as I'd done before. However, no
matter what I do this time, the db comes out as en_US.UTF-8, not "C".
I've unset LC_CTYPE and LC_COLLATE in the env, I've set them both to C,
I've specified the encoding and ctype on the initdb command line (see
below), but nothing changes!

-bash-3.00$ initdb -E SQL_ASCII --locale=C test
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.

creating directory test ... ok
creating directory test/global ... ok
creating directory test/pg_xlog ... ok
creating directory test/pg_xlog/archive_status ... ok
creating directory test/pg_clog ... ok
creating directory test/pg_subtrans ... ok
creating directory test/base ... ok
creating directory test/base/1 ... ok
creating directory test/pg_tblspc ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 1000
creating configuration files ... ok
creating template1 database in test/base/1 ... ok
initializing pg_shadow ... ok
enabling unlimited row size for system tables ... ok
initializing pg_depend ... ok
creating system views ... ok
loading pg_description ... ok
creating conversions ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the -A option the
next time you run initdb.

Success. You can now start the database server using:

postmaster -D test
or
pg_ctl -D test -l logfile start

-bash-3.00$ createdb -E SQL_ASCII test
CREATE DATABASE
-bash-3.00$ psql -d test
Welcome to psql 8.0.0rc5, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit

test=# show lc_ctype;
lc_ctype
-------------
en_US.UTF-8
(1 row)

-bash-3.00$ psql -l
List of databases
Name | Owner | Encoding
-----------+----------+-----------
template0 | postgres | UNICODE
template1 | postgres | UNICODE
test | postgres | SQL_ASCII
(3 rows)

The encoding gets set properly, but the lc_ctype never changes.

What have I missed??? I can't get lc_ctype to change.

Thanks for any ideas!

Bret

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Rodolfo J. Paiz 2005-02-03 15:38:25 Re: DB Error: connect failed [SOLVED]
Previous Message Tom Lane 2005-02-03 14:39:14 Re: Scripting a pg_dumpall/pg_dump backup using bash or perl