Default encoding in database

Started by Jacob Vennervald Madsenover 24 years ago6 messagesgeneral
Jump to latest
#1Jacob Vennervald Madsen
jvm@gopinocchio.com

Hi List

I'm using PostgreSQL version PostgreSQL 7.1.2
When I create a new database it's made with SQL_ASCII by default.
What do I have to do to make LATIN1 the default encoding?
This is how I configured Postgres
./configure --with-java --enable-odbc --enable-multibyte=LATIN1
--enable-locale --enable-unicode-conversion

Can anybody help me?

Best regards,
Jacob Vennervald Madsen
Mobile Systems Developer

GoPinocchio
Norrebrogade 45
DK-2200 Copenhagen
www.gopinocchio.com
+45 26750106

**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

#2Tatsuo Ishii
t-ishii@sra.co.jp
In reply to: Jacob Vennervald Madsen (#1)
Re: Default encoding in database

I'm using PostgreSQL version PostgreSQL 7.1.2
When I create a new database it's made with SQL_ASCII by default.
What do I have to do to make LATIN1 the default encoding?
This is how I configured Postgres
./configure --with-java --enable-odbc --enable-multibyte=LATIN1
--enable-locale --enable-unicode-conversion

I guess you have multibyte disabled or not configured as
"--enable-multibyte=LATIN1" another PostgreSQL somewhere.

Or you have done initdb with such PostgreSQL.

How does the output from "psql -l" look like?
--
Tatsuo Ishii

#3Tatsuo Ishii
t-ishii@sra.co.jp
In reply to: Tatsuo Ishii (#2)
RE: Default encoding in database

How does the output from "psql -l" look like?

List of databases
Database | Owner | Encoding
------------+----------+-----------
template0 | postgres | SQL_ASCII
template1 | postgres | SQL_ASCII
Jacob

I don't know why your template1 DB's encoding is SQL_ASCII, but you
need to change the encoding of the DB anyway.

try:

psql -c "update pg_database set encoding = 7 where datname =
'template1'" template1
--
Tatsuo Ishii

#4Karel Zak
zakkr@zf.jcu.cz
In reply to: Tatsuo Ishii (#3)
Re: Default encoding in database

On Thu, Aug 30, 2001 at 05:28:16PM +0900, Tatsuo Ishii wrote:

How does the output from "psql -l" look like?

List of databases
Database | Owner | Encoding
------------+----------+-----------
template0 | postgres | SQL_ASCII
template1 | postgres | SQL_ASCII
Jacob

I don't know why your template1 DB's encoding is SQL_ASCII, but you
need to change the encoding of the DB anyway.

try:

psql -c "update pg_database set encoding = 7 where datname =
'template1'" template1

IMHO more careful is re-build it by initdb with option -E LATIN1.

KArel

--
Karel Zak <zakkr@zf.jcu.cz>
http://home.zf.jcu.cz/~zakkr/

C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz

#5Jacob Vennervald Madsen
jvm@gopinocchio.com
In reply to: Karel Zak (#4)
RE: Default encoding in database

If I do rebuild it with initdb will I still have all my data?

Jacob

-----Original Message-----
From: Karel Zak [mailto:zakkr@zf.jcu.cz]
Sent: 30. august 2001 11:03
To: Tatsuo Ishii
Cc: Jacob Vennervald Madsen; pgsql-general@postgresql.org
Subject: Re: Default encoding in database

On Thu, Aug 30, 2001 at 05:28:16PM +0900, Tatsuo Ishii wrote:

How does the output from "psql -l" look like?

List of databases
Database | Owner | Encoding
------------+----------+-----------
template0 | postgres | SQL_ASCII
template1 | postgres | SQL_ASCII
Jacob

I don't know why your template1 DB's encoding is SQL_ASCII, but you
need to change the encoding of the DB anyway.

try:

psql -c "update pg_database set encoding = 7 where datname =
'template1'" template1

IMHO more careful is re-build it by initdb with option -E LATIN1.

KArel

--
Karel Zak <zakkr@zf.jcu.cz>
http://home.zf.jcu.cz/~zakkr/

C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz

#6Karel Zak
zakkr@zf.jcu.cz
In reply to: Jacob Vennervald Madsen (#5)
Re: Default encoding in database

On Thu, Aug 30, 2001 at 11:04:39AM +0200, Jacob Vennervald Madsen wrote:

If I do rebuild it with initdb will I still have all my data?

No of course, initdb create everything again... but if you have
only templates DB you probably haven't some data, else you must
dump all your DB and backup it and rebuild templates.

List of databases
Database | Owner | Encoding
------------+----------+-----------
template0 | postgres | SQL_ASCII
template1 | postgres | SQL_ASCII
Jacob

BTW, I don't understand why you don't create new databases by
CREATE DATABASE bar WITH ENCODING = 'foo' or by "createdb -E".

Karel

--
Karel Zak <zakkr@zf.jcu.cz>
http://home.zf.jcu.cz/~zakkr/

C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz