From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
---|---|
To: | Postgresql Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Encoding problem with 7.4 |
Date: | 2003-12-03 15:15:39 |
Message-ID: | 3FCDFE1B.6050300@dunslane.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
E.Rodichev wrote:
>On Fri, 28 Nov 2003, Tom Lane wrote:
>
>
>
>>"E.Rodichev" <er(at)sai(dot)msu(dot)su> writes:
>>
>>
>>>/e:2>createdb test
>>>
>>>
>>> test | er | SQL_ASCII <----- Incorrect!
>>>(3 rows)
>>>
>>>
>>>Let's note than the last line is in fact completely incorrect.
>>>
>>>
>>What's incorrect about it? You didn't ask for any other encoding
>>than SQL_ASCII.
>>
>>
>
>It is incorrect, because database "test" is, really, in KOI8, NOT in SQL_ASCII
>in this example, as I explained in my mail.
>
>Best wishes,
>E.R.
>
>
>
>>You can set the default encoding at initdb time, IIRC, but you didn't.
>>
You can set the default at initdb time, or per database at createdb
time, but it has to be done explicitly. You seem to think it should be
picked up from the environment, but this isn't so, you must use the
-E|--encoding flag on either createdb or initdb, or if creating directly
from SQL use the ENCODING option on "create database" to use something
other than the default set by initdb.
examples:
[andrew(at)Thor bin]$ ./initdb /tmp/enctry
The files belonging to this database system will be owned by user "andrew".
This user must also own the server process.
The database cluster will be initialized with locales:
COLLATE: ru_RU.KOI8-R
CTYPE: ru_RU.KOI8-R
MESSAGES: en_US.iso885915
MONETARY: en_US.iso885915
NUMERIC: en_US.iso885915
TIME: en_US.iso885915
creating directory /tmp/enctry... ok
creating directory /tmp/enctry/base... ok
creating directory /tmp/enctry/global... ok
creating directory /tmp/enctry/pg_xlog... ok
creating directory /tmp/enctry/pg_clog... ok
selecting default max_connections... 100
selecting default shared_buffers... 1000
creating configuration files... ok
creating template1 database in /tmp/enctry/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
Success. You can now start the database server using:
./postmaster -D /tmp/enctry
or
./pg_ctl -D /tmp/enctry -l logfile start
[andrew(at)Thor bin]$ ./pg_ctl -D /tmp/enctry -l /tmp/enclog -o '-p 5433' start
postmaster successfully started
[andrew(at)Thor bin]$ ./createdb -E KOI8-R -p 5433 testme
CREATE DATABASE
[andrew(at)Thor bin]$ ./psql -p 5433 -l
List of databases
Name | Owner | Encoding
-----------+--------+-----------
template0 | andrew | SQL_ASCII
template1 | andrew | SQL_ASCII
testme | andrew | KOI8
(3 rows)
[andrew(at)Thor bin]$ ./pg_ctl -D /tmp/enctry -o '-p 5433' stop
waiting for postmaster to shut down......done
postmaster successfully shut down
[andrew(at)Thor bin]$ rm -rf /tmp/enctry
[andrew(at)Thor bin]$ ./initdb -E KOI8-R /tmp/enctry
The files belonging to this database system will be owned by user "andrew".
This user must also own the server process.
The database cluster will be initialized with locales:
COLLATE: ru_RU.KOI8-R
CTYPE: ru_RU.KOI8-R
MESSAGES: en_US.iso885915
MONETARY: en_US.iso885915
NUMERIC: en_US.iso885915
TIME: en_US.iso885915
creating directory /tmp/enctry... ok
creating directory /tmp/enctry/base... ok
creating directory /tmp/enctry/global... ok
creating directory /tmp/enctry/pg_xlog... ok
creating directory /tmp/enctry/pg_clog... ok
selecting default max_connections... 100
selecting default shared_buffers... 1000
creating configuration files... ok
creating template1 database in /tmp/enctry/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
Success. You can now start the database server using:
./postmaster -D /tmp/enctry
or
./pg_ctl -D /tmp/enctry -l logfile start
[andrew(at)Thor bin]$ ./pg_ctl -D /tmp/enctry -l /tmp/enclog -o '-p 5433' start
postmaster successfully started
[andrew(at)Thor bin]$ ./createdb -p 5433 testme
CREATE DATABASE
[andrew(at)Thor bin]$ ./psql -p 5433 -l
List of databases
Name | Owner | Encoding
-----------+--------+----------
template0 | andrew | KOI8
template1 | andrew | KOI8
testme | andrew | KOI8
(3 rows)
[andrew(at)Thor bin]$
cheers
andrew
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Dunstan | 2003-12-03 15:47:34 | Re: Inside the Regex Engine |
Previous Message | Robert Treat | 2003-12-03 13:48:26 | Re: 7.3.5 bundled ... |