initdb stores default client_encoding from environment-variable

Поиск
Список
Период
Сортировка
От Wolfgang.Koenig
Тема initdb stores default client_encoding from environment-variable
Дата
Msg-id 227142482560EF458FF1F7E784E26AB8022B4D0E@FLBVEXCH01.versatel.local
обсуждение исходный текст
Ответы Re: initdb stores default client_encoding from environment-variable  (Robert Haas <robertmhaas@gmail.com>)
Re: initdb stores default client_encoding from environment-variable  (Craig Ringer <craig@postnewspapers.com.au>)
Re: initdb stores default client_encoding from environment-variable  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
initdb stores default client_encoding from environment-variable


Postgres Version: 8.4.3 and 8.3.6
Operating System: Sun Solaris 5.10 and SuseEnterprise 9

When a database is initialized with the initdb-command, the default
client_enconding, which will be stored in the DB, depends on the value
of the environment-variable PGCLIENTENCODING at the time of running
initdb. This behaviour is not documented.
Furthermore I didn't find a command to change this
default client_encoding in the database later.
The default client_encoding does not depend on the database encoding!

This is a small shell-script to show this behaviour.

#!/bin/bash -x
#
PGHOST=3D"localhost"
PGPORT=3D7654
PGDATABASE=3Dpostgres
PGUSER=3Dpostgres
export PGHOST PGPORT PGDATABASE PGUSER
export LD_LIBRARY_PATH=3D/usr/local/pgsql/lib

binpath=3D/usr/local/pgsql/bin
dir=3D/data/DB-2

$binpath/pg_ctl stop -D $dir/pg-base -m fast -o '-p 7654'
#
#  remove Database
#
rm -r $dir/pg-base       2> /dev/null
sleep 1
mkdir $dir/pg-base       2> /dev/null

PGCLIENTENCODING=3D"WIN1250"
export PGCLIENTENCODING

$binpath/initdb --encoding=3DUTF8 -D $dir/pg-base

$binpath/pg_ctl start -D $dir/pg-base -l $dir/pg-server.log -o '-p 7654'

sleep 5

unset PGCLIENTENCODING  #  IMPORTANT !!

$binpath/psql -c "select version();"
$binpath/psql -c "show client_encoding;"

В списке pgsql-bugs по дате отправления:

Предыдущее
От: 黄永卫
Дата:
Сообщение: About “context-switching issue on Xeon” test case ?
Следующее
От: Andy Balholm
Дата:
Сообщение: Re: bugs that have not been replied-to on list