Thread: Can't change LC_CTYPE/locale
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
"Schuhmacher, Bret" <Bret.Schuhmacher@Aspect.com> writes: > 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! This is a stupid suggestion, but since you showed your steps and didn't mention this one: did you remember to stop and restart the postmaster over the initdb? regards, tom lane
Thanks for the response, Tom. Looks like the problem was a bad directory given to pg_ctl for my start script. It was pointing to /usr/local/pgsql/data, not /var/lib/pgsql/data. I think I might've had two identical databases in different directories... Seems to be fixed now, though. I appreciate your time! :-) Rgds, Bret > -----Original Message----- > From: Tom Lane [mailto:tgl@sss.pgh.pa.us] > Sent: Thursday, February 03, 2005 11:29 AM > To: Schuhmacher, Bret > Cc: pgsql-novice@postgresql.org > Subject: Re: [NOVICE] Can't change LC_CTYPE/locale > > "Schuhmacher, Bret" <Bret.Schuhmacher@Aspect.com> writes: > > 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! > > This is a stupid suggestion, but since you showed your steps > and didn't mention this one: did you remember to stop and > restart the postmaster over the initdb? > > regards, tom lane >